Warning: This is the manual of the legacy Guile 2.2 series. You may want to read the manual of the current stable series instead.

Next: , Previous: , Up: SRFI-19   [Contents][Index]


7.5.16.5 SRFI-19 Date to string

Function: date->string date [format]

Convert a date to a string under the control of a format. format should be a string containing ‘~’ escapes, which will be expanded as per the following conversion table. The default format is ‘~c’, a locale-dependent date and time.

Many of these conversion characters are the same as POSIX strftime (see Time), but there are some extras and some variations.

~~literal ~
~alocale abbreviated weekday, eg. ‘Sun
~Alocale full weekday, eg. ‘Sunday
~blocale abbreviated month, eg. ‘Jan
~Blocale full month, eg. ‘January
~clocale date and time, eg.
Fri Jul 14 20:28:42-0400 2000
~dday of month, zero padded, ‘01’ to ‘31
~eday of month, blank padded, ‘ 1’ to ‘31
~fseconds and fractional seconds, with locale decimal point, eg. ‘5.2
~hsame as ~b
~Hhour, 24-hour clock, zero padded, ‘00’ to ‘23
~Ihour, 12-hour clock, zero padded, ‘01’ to ‘12
~jday of year, zero padded, ‘001’ to ‘366
~khour, 24-hour clock, blank padded, ‘ 0’ to ‘23
~lhour, 12-hour clock, blank padded, ‘ 1’ to ‘12
~mmonth, zero padded, ‘01’ to ‘12
~Mminute, zero padded, ‘00’ to ‘59
~nnewline
~Nnanosecond, zero padded, ‘000000000’ to ‘999999999
~plocale AM or PM
~rtime, 12 hour clock, ‘~I:~M:~S ~p
~snumber of full seconds since “the epoch” in UTC
~Ssecond, zero padded ‘00’ to ‘60
(usual limit is 59, 60 is a leap second)
~thorizontal tab character
~Ttime, 24 hour clock, ‘~H:~M:~S
~Uweek of year, Sunday first day of week, ‘00’ to ‘52
~Vweek of year, Monday first day of week, ‘01’ to ‘53
~wday of week, 0 for Sunday, ‘0’ to ‘6
~Wweek of year, Monday first day of week, ‘00’ to ‘52
~yyear, two digits, ‘00’ to ‘99
~Yyear, full, eg. ‘2003
~ztime zone, RFC-822 style
~Ztime zone symbol (not currently implemented)
~1ISO-8601 date, ‘~Y-~m-~d
~2ISO-8601 time+zone, ‘~H:~M:~S~z
~3ISO-8601 time, ‘~H:~M:~S
~4ISO-8601 date/time+zone, ‘~Y-~m-~dT~H:~M:~S~z
~5ISO-8601 date/time, ‘~Y-~m-~dT~H:~M:~S

Conversions ‘~D’, ‘~x’ and ‘~X’ are not currently described here, since the specification and reference implementation differ.

Conversion is locale-dependent on systems that support it (see Accessing Locale Information). See setlocale, for information on how to change the current locale.


Next: , Previous: , Up: SRFI-19   [Contents][Index]