License:
BSD style: see license.txtVersion:
Jan 2005: initial release Mar 2009: extracted from locale, and converted to a structAuthor:
John Chapman, Kris, mwarning Support for formatting date/time values, in a locale-specific manner. See DateTimeLocale.format() for a description on how formatting is performed (below). Reference links:
1 2 | http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo(VS.71).aspx |
"t" = 7:04 "T" = 7:04:02 PM "d" = 3/30/2009 "D" = Monday, March 30, 2009 "f" = Monday, March 30, 2009 7:04 PM "F" = Monday, March 30, 2009 7:04:02 PM "g" = 3/30/2009 7:04 PM "G" = 3/30/2009 7:04:02 PM "y" "Y" = March, 2009 "r" "R" = Mon, 30 Mar 2009 19:04:02 GMT "s" = 2009-03-30T19:04:02 "u" = 2009-03-30 19:04:02ZFor the US locale, these generic layouts are expanded in the following manner:
"t" = "h:mm" "T" = "h:mm:ss tt" "d" = "M/d/yyyy" "D" = "dddd, MMMM d, yyyy" "f" = "dddd, MMMM d, yyyy h:mm tt" "F" = "dddd, MMMM d, yyyy h:mm:ss tt" "g" = "M/d/yyyy h:mm tt" "G" = "M/d/yyyy h:mm:ss tt" "y" "Y" = "MMMM, yyyy" "r" "R" = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'" "s" = "yyyy'-'MM'-'dd'T'HH':'mm':'ss" "u" = "yyyy'-'MM'-'dd' 'HH':'mm':'ss'Z'"Custom layouts are constructed using a combination of the character codes indicated on the right, above. For example, a layout of "dddd, dd MMM yyyy HH':'mm':'ss zzzz" will emit something like this:
1 | Monday, 30 Mar 2009 19:04:02 -08:00 |
1 2 3 | Stdout.formatln ("{:u}", 5); Stdout.formatln ("{:b}", 5); Stdout.formatln ("{:x}", 5); |
1 2 3 | Stdout.formatln ("{:t}", Clock.now); Stdout.formatln ("{:D}", Clock.now); Stdout.formatln ("{:dddd, dd MMMM yyyy HH:mm}", Clock.now); |