Return to VBA Code Examples

VBA Format Time

This tutorial will demonstrate how to use the Format VBA function to format time.

Format Function and Time

VBA Format Time with Predefined Formats

The VBA Format function can be used to convert a number to a string with a predefined format. The available formats for time are long time, medium time, and short time.

VBA Format Time with Custom Formats

The VBA Format function can be used to convert a number to a string with custom formats. Symbols h and hh are used for hours, n and nn for minutes, s and ss for seconds, ttttt for full time according to system settings and AM/PM, am/pm, A/P, a/p, AMPM for the am-pm system.

 

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro - A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users! vba save as


Learn More!