Thunderstone Software Document Retreival and Management
Search:
Advanced Search
Home | Products | Company | News | Tech Support | Demos | Contact Us
Vortex Manual

Printing Date/Time Values

 

Dates can be printed with fmt by using the %at format. The t code indicates a time is being printed, and the a flag indicates that the next argument is a strftime() gif -style format string. Following that is a time argument. Example: <fmt "%at" "%B" "now"> where "%B" is the strftime()-style string (indicating the month should be printed). A capital T may be used instead of lower-case t to indicate Universal Time instead of local time for output. These strftime() codes are available:

  • %a for the abbreviated weekday name (eg. Sun, Mon, Tue, etc.)

  • %A for the full weekday name (eg. Sunday, Monday, Tuesday, etc.)

  • %b for the abbreviated month name (eg. Jan, Feb, Mar, etc.)

  • %B for the full month name (eg. January, February, March, etc.)

  • %c for the preferred date and time representation.

  • %d for the day of the month as a decimal number (range 00 to 31).

  • %H for the hour as a decimal number using a 24-hour clock (range 00 to 23).

  • %I for the hour as a decimal number using a 12-hour clock (range 01 to 12).

  • %j for the day of the year as a decimal number (range 001 to 366).

  • %m for the month as a decimal number (range 01 to 12).

  • %M for the minute as a decimal number (range 00 to 59).

  • %p for AM or PM, depending on the time.

  • %S for the second as a decimal number (range 00 to 61).

  • %U for the week number of the current year as a decimal number, starting with the first Sunday as the first day of the first week (range 00 to 53).

  • %W for the week number of the current year as a decimal number, starting with the first Monday as the first day of the first week (range 00 to 53).

  • %w for the day of the week as a decimal, Sunday being 0.

  • %x for the preferred date representation without the time.

  • %X for the preferred time representation without the date.

  • %y for the year as a decimal number without a century (range 00 to 99).

  • %Y for the year as a decimal number including the century.

  • %Z for the time zone or name or abbreviation.

  • %% for a literal `%' character.

Since fmt arguments are typecast if needed (p.  gif ), the date argument can be a Texis date or counter type, or a Texis-parseable date string. For example, to print today's date in the form month/day/year:

  <fmt "%at" "%m/%d/%y" "now">

Or to print the title and insertion date of books matching a query, in the style ``February 20, 1997'' (assuming id is a Texis counter field):

  <SQL "select id, Title from books where Desc like $query">
    <fmt "%at" "%B %d, %Y" $id>  $Title
  </SQL>

If the strftime() string is composed entirely of strftime()-specific codes, none of which have meaning as <fmt> codes, and there is only one argument given, then the initial %at may be omitted. For example, to print today's year, either of these statements may be used:

  <fmt "%at" "%Y" "now">
  <fmt       "%Y" "now">

The second statement eliminates the %at, because %Y is a strftime()-only code (not valid in <fmt>). Note: Due to potential confusion and conflicts between strftime() and <fmt> codes, use of this shorthand is not recommended. Always use the t or T code.

To use a default strftime() format, eliminate the a flag and the strftime() format:

  <fmt "%t" "now">

This will print today's date in a default format.


CAVEATS
As dates are printed using the standard C library, not all strftime() codes are available or behave identically on all platforms.


Copyright © Thunderstone Software     Last updated: Wed Sep 10 11:16:28 EDT 2008
 
Home   ::   Products   ::   Company   ::   News   ::   Tech Support   ::   Demos   ::   Contact Us
Copyright © 2008 Thunderstone Software LLC. All rights reserved.