Date Formats

Tinderbox Icon

Tinderbox offers numerous date formats. An example date Tue, 29 Apr 2003 14:32:18 - 0500 is used to show the following various format strings below. Note below that the colons after each (bolded) code are not part of that format code but just a divider from the text that follows it. Dates before 1 January 1904 (start of the Mac OS calendar) are supported - see more.

Important note - the examples here are for US & UK system settings so as to illustrate day/month and month days variations. The exact format you see on your system may differ depending on your computer OS' local system settings (OS X, see System Preferences - International - formats). For reference this TBX was authored on a system using UK settings.

Date/Time formatting codes:-

L  : local date/time, as in the 'long' format of the host system format settings. Examples:

US: April 29, 2003 

UK: 29 April 2003

l  : local date, in short format, using the system format settings. Examples:

US: 4-29-03 

UK: 29/01/03

*  : date/time in RFC 822 format. Example: Tue, Apr 29, 2003 14:32:18 +0500 

=  : date in ISO 8601 format. Example: 2003-04-29T14:32:18+05:00

Formatting codes for the day part of a date:-

d  : day of the month, not zero-padded. Example: 9 (note, not '09')

D  : formats the date of the month as a two digit number, with a leading zero as required (01-31). Example: 29 

w  : abbreviation of weekday. Example: Tue 

W  : name of weekday. Example: Tuesday 

Formatting codes for the month part of a date:-

m  : number of month, not zero-padded. Example: 4 (note, not '04')

M0  : formats the month as a two digit number, with a leading zero as required: 01-12. Example: 04. Note the second format character is zero, i.e. the format code is 'em-zero' not 'em-oh'.

M  : abbreviation of month. Example: Apr 

MM  : name of month. Example: April 

Formatting codes for the year part of a date:-

y  : 4 digit year. Example: 2003. (On some countries' settings this may still be 2 digits.)

Y  : 2 digit year (last 2 digits of year). Example: 03 

Formatting codes for time:-

t  : time, in local format. Examples:

US: 2:32 PM 

UK: 00:32

Formatting codes for the hour part of a time:-

h  : hour of the day on a 24-hour clock, zero-padded for single digits. Examples: 14 from 14:32/2:32 PM, 05 from 05:32/5:32 AM.

H  : hour of the day on a 12-hour clock. Example: 2 from 14:32/2:32 PM, 5 from 05:32/5:32 AM. Use with 'p' to show AM or PM suffix, e.g. "H:mm p" gives 2:32 PM.

p  : the A.M. or P.M. of the hour, always uppercase, with no periods. Example: AM 

Formatting codes for the minute part of a time:-

mm  : minute of the hour, zero-padded for single digits. Examples: 32 for 32 past or 05 for five minutes after the hour.

Formatting codes for the seconds part of a time:-

s  : second of minute, zero-padded for single digits. Examples: 02, 18

Escaping any of above as literals:-

Prefacing any character with a backslash, \, includes the that character literally, even if it otherwise has a special meaning in the above list. Thus a format string of "\dd \mm \yY" gives the output d29 m4 y03. Any other character includes the character. Thus, the format string "Local time:- h:mm:s" gives output of Local time:- 14:32:18.


Up: Import/Export/Formatting
Previous: Copying/Moving text within Tinderbox  Next: Dragging a URL from web browser 

[Last updated: 14 Dec 2009, using v5.0]

Google search aTbRef for:  

Licensed under Creative Commons Attribution-Noncommercial-Share Alike 3.0 License
[See aTbRef CC licence Attribution/Waiver info info]

Creative Commons License

Made with Tinderbox