Custom date and time formats for the FORMAT function. 4 minutes to read.In this articleThe following table shows characters you can use to create user-defined date/time formats. Format specificationDescription(:)Time separator. In some locales, other characters may be used to represent the time separator. The time separator separates hours, minutes, and seconds when time values are formatted. The actual character that is used as the time separator in formatted output is determined by your application's current culture value.(/)Date separator. In some locales, other characters may be used to represent the date separator.
The date separator separates the day, month, and year when date values are formatted. The actual character that is used as the date separator in formatted output is determined by your application's current culture.(%)Used to indicate that the following character should be read as a single-letter format without regard to any trailing letters. Also used to indicate that a single-letter format is read as a user-defined format. See what follows for additional details.dDisplays the day as a number without a leading zero (for example, 1). Use%d if this is the only character in your user-defined numeric format.ddDisplays the day as a number with a leading zero (for example, 01).dddDisplays the day as an abbreviation (for example, Sun).ddddDisplays the day as a full name (for example, Sunday).MDisplays the month as a number without a leading zero (for example, January is represented as 1). Use%M if this is the only character in your user-defined numeric format.MMDisplays the month as a number with a leading zero (for example, 01/12/01).MMMDisplays the month as an abbreviation (for example, Jan).MMMMDisplays the month as a full month name (for example, January).ggDisplays the period/era string (for example, A.D.).hDisplays the hour as a number without leading zeros using the 12-hour clock (for example, 1:15:15 PM). Use%h if this is the only character in your user-defined numeric format.hhDisplays the hour as a number with leading zeros using the 12-hour clock (for example, 01:15:15 PM).HDisplays the hour as a number without leading zeros using the 24-hour clock (for example, 1:15:15).
Use%H if this is the only character in your user-defined numeric format.HHDisplays the hour as a number with leading zeros using the 24-hour clock (for example, 01:15:15).mDisplays the minute as a number without leading zeros (for example, 12:1:15). Use%m if this is the only character in your user-defined numeric format.mmDisplays the minute as a number with leading zeros (for example, 12:01:15).sDisplays the second as a number without leading zeros (for example, 12:15:5).