FunctionPackage: exclToCDocOverviewCGDocRelNotesIndexPermutedIndex
Allegro CL version 6.2
Unrevised from 6.1

locale-format-time

Arguments: stream ut show-date show-time &optional (locale *locale*)fmt

Arguments:

This function outputs to the stream a locale appropriate representation of the time specified by ut. The output format can be specified as a string following the XPG4 strftime() format (see below). If fmt is non-nil, then the date and time booleans are ignored. Otherwise, if fmt is nil, then the date and time booleans determine the format based on the following table:

show-date show-time fmt control string
false false (locale-t-fmt-ampm locale)
false true (locale-t-fmt locale)
true false (locale-d-fmt locale)
true true (locale-d-t-fmt locale)

The function locale-format-time can be invoked using the format ~/ directive. The locale argument can be supplied using format's ~v prefix argument. The fmt argument can be supplied as the second prefix argument. The show-date argument is specified using the colon modifier. The show-time argument is specified using the at-sign modifier.

The LC_TIME category defines display formats using conversion specifications which are also defined in the category. The conversion specifications consist of a '%' followed by one or two letters. The formats are intended for the XPG4 strftime() function.

The print-date-time function outputs the date/time as specified by the format string in the same way as strftime(). In addition to the field descriptor definitions, the print-date-time function will interpret the following C escape sequences as follows:

 \\	insert #\\
 \a	insert #\bell
 \b	insert #\backspace
 \f	insert #\page
 \n	insert #\linefeed
 \r	insert #\return
 \t	insert #\tab
 \v	insert #\vt

These are the field descriptor definitions:

  %%      same as %
  %a      locale's abbreviated weekday name
  %A      locale's full weekday name
  %b      locale's abbreviated month name
  %B      locale's full month name
  %c      locale's appropriate date and time representation
  %C      century number (the year divided by  100  and  trun-
	  cated  to  an  integer  as a decimal number [1,99]);
	  single digits are preceded by 0
  %d      day of month [1,31]; single digits are preceded by 0
  %D      date as %m/%d/%y
  %e      day of month [1,31]; single digits are preceded by a
	  space
  %h      locale's abbreviated month name
  %H      hour (24-hour clock) [0,23]; single digits are  pre-
	  ceded by 0
  %I      hour (12-hour clock) [1,12]; single digits are  pre-
	  ceded by 0
  %j      day number of year [1,366]; single digits  are  pre-
	  ceded by 0
  %k      hour (24-hour clock) [0,23]; single digits are  pre-
	  ceded by a blank
  %l      hour (12-hour clock) [1,12]; single digits are  pre-
	  ceded by a blank
  %m      month number [1,12]; single digits are preceded by 0
  %M      minute [00,59]; leading zero is  permitted  but  not
	  required
  %n      insert a newline
  %p      locale's equivalent of either a.m. or p.m.
  %r      appropriate time  representation  in  12-hour  clock
	  format with %p
  %R      time as %H:%M
  %S      seconds [00,61]
  %t      insert a tab
  %T      time as %H:%M:%S
  %u      weekday as a decimal number [1,7], with 1 represent-
	  ing Sunday
  %U      week number of year as  a  decimal  number  [00,53],
	  with Sunday as the first day of week 1
  %V      week number of the year as a decimal number [01,53],
	  with  Monday  as  the first day of the week.  If the
	  week containing 1 January has four or more  days  in
	  the  new  year, then it is considered week 1; other-
	  wise, it is week 53 of the previous  year,  and  the
	  next week is week 1.
  %w      weekday as a decimal number [0,6], with 0 represent-
	  ing Sunday
  %W      week number of year as  a  decimal  number  [00,53],
	  with Monday as the first day of week 1
  %x      locale's appropriate date representation
  %X      locale's appropriate time representation
  %y      year within century [00,99]
  %Y      year, including the century (for example 1993)
  %Z      time zone name or abbreviation, or no  bytes  if  no
	  time zone information exists

Modified Conversion Specifications

Some conversion specifications can be modified by the E and O modifiers to indicate that an alternate format or specification should be used rather than the one normally used by the unmodified conversion specification. If the alternate format or specification does not exist in the current locale, the behavior will be as if the unmodified specification were used.

  %Ec     locale's  alternate  appropriate   date   and   time
	  representation
  %EC     name of the  base  year  (period)  in  the  locale's
	  alternate representation
  %Ex     locale's alternate date representation
  %EX     locale's alternate time representation
  %Ey     offset from %EC (year only) in the  locale's  alter-
	  nate representation
  %EY     full alternate year representation
  %Od     day  of  the  month  using  the  locale's  alternate
	  numeric symbols
  %Oe     same as %Od
  %OH     hour (24-hour clock) using  the  locale's  alternate
	  numeric symbols
  %OI     hour (12-hour clock) using  the  locale's  alternate
	  numeric symbols
  %Om     month using the locale's alternate numeric symbols
  %OM     minutes using the locale's alternate numeric symbols
  %OS     seconds using the locale's alternate numeric symbols
  %OU     week number of the year (Sunday as the first day  of
	  the  week) using the locale's alternate numeric sym-
	  bols
  %Ow     number of the weekday (Sunday=0) using the  locale's
	  alternate numeric symbols
  %OW     week number of the year (Monday as the first day  of
	  the  week) using the locale's alternate numeric sym-
	  bols
  %Oy     year (offset from  %C)  in  the  locale's  alternate

	  representation  and  using  the  locale's  alternate
	  numeric symbols

Example:

;;  [assuming *locale* is (find-locale "en_US")]

(format t "~/locale-format-time/" 3192624000)
  prints `08:00:00 AM '

(format t "~:/locale-format-time/" 3192624000)
  prints `Saturday, March 03, 2001'

(format t "~@/locale-format-time/" 3192624000)
  prints `08:00:00  '

(format t "~:@/locale-format-time/" 3192624000)
  prints `Saturday, March 03, 2001 08:00:00 AM '

(format t "~v:@/locale-format-time/" :fr_FR 3192624000)
  prints `samedi 03 mars 2001 08 h 00 '

(format t "~v,v:@/locale-format-time/" :fr_FR "%A" 3192624000)
  prints `samedi'

(format t "~,v:@/locale-format-time/" "%A" 3192624000)
  prints `Saturday'

See Localization support in Allegro CL in iacl.htm.


Copyright (c) 1998-2002, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 6.2. This page was not revised from the 6.1 page.
Created 2002.2.26.

ToCDocOverviewCGDocRelNotesIndexPermutedIndex
Allegro CL version 6.2
Unrevised from 6.1