lc_time_fmt (public)
lc_time_fmt datetime fmt [ locale ]
Defined in packages/acs-lang/tcl/localization-procs.tcl
Formats a time for the specified locale.
- Parameters:
- datetime (required)
- A datetime in one of the supported formats. See lc_datetime_to_clock.
- fmt (required)
- An ISO 14652 LC_TIME style formatting string. The highlighted functions localize automatically based on the user's locale; other strings will use locale-specific text but not necessarily locale-specific formatting.
%a FDCC-set's abbreviated weekday name. %A FDCC-set's full weekday name. %b FDCC-set's abbreviated month name. %B FDCC-set's full month name. %c FDCC-set's appropriate date and time representation. %C Century (a year divided by 100 and truncated to integer) as decimal number (00-99). %d Day of the month as a decimal number (01-31). %D Date in the format mm/dd/yy. %e Day of the month as a decimal number (1-31 in at two-digit field with leadingfill). %E Month number as a decimal number (1-12 in at two-digit field with leading fill). %f Weekday as a decimal number (1(Monday)-7). %F is replaced by the date in the format YYYY-MM-DD (ISO 8601 format) %h A synonym for %b. %H Hour (24-hour clock) as a decimal number (00-23). %I Hour (12-hour clock) as a decimal number (01-12). %j Day of the year as a decimal number (001-366). %m Month as a decimal number (01-13). %M Minute as a decimal number (00-59). %n A character. %p FDCC-set's equivalent of either AM or PM. %r Hours and minutes using 12-hour clock AM/PM notation, e.g. '06:12 AM'. %q Long date without weekday (OpenACS addition to the standard) %Q Long date with weekday (OpenACS addition to the standard) %S Seconds as a decimal number (00-61). %t A character. %T 24-hour clock time in the format HH:MM:SS. %u Week number of the year as a decimal number with two digits and leading zero, according to "week" keyword. %U Week number of the year (Sunday as the first day of the week) as a decimal number (00-53). %w Weekday as a decimal number (0(Sunday)-6). %W Week number of the year (Monday as the first day of the week) as a decimal number (00-53). %x FDCC-set's appropriate date representation. %X FDCC-set's appropriate time representation. %y Year (offset from %C) as a decimal number (00-99). %Y Year with century as a decimal number. %Z The connection's timezone, e.g. 'America/New_York'. %% A character. - locale (optional)
- Locale identifier must be in the locale database
- Returns:
- A date formatted for a locale
- Error:
- Fails if given a non-existent locale or a malformed datetime. Impossible dates will be treated as per clock scan behavior and e.g. 29 Feb 1999 will be translated to 1st March, Monday, as it wasn't a leap year. The clock api takes care of the proper handling of Julian/Gregorian dates.
- See Also:
- lc_datetime_to_clock
- http://www.tondering.dk/claus/calendar.html
- man strftime on a UNIX shell prompt for more date format abbreviations.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- lang_test__lc_procs, lc_time_fmt_Z_timezone