|
|
Section Intro: Dates And Times
Dates And TimesSynopsis:
Meta-HTML provides a number of pre-defined functions for manipulating
date and time objects. Along with the primitive builtins of <date>
and <time>, there are several functions defined with the prefix of
Commands:
Returns the date as a string of 24 characters.
The output looks like Given the optional argument EPOCH-SECONDS, this number is treated as the number of seconds since 12 midnight, December 31st, 1969, and is converted into the current date. When the keyword argument GMT=TRUE is supplied, returns the date at the meridian (Greenwich Mean Time) in the same format as used by HTTP headers, such as the Expires header. Examples: <date> ==> Thu Nov 13 10:52:07 1997 <date gmt=true> ==> Thu, 13 Nov 1997 18:52:07 GMT <date <add <time> 60>> ==> Thu Nov 13 10:53:07 1997
Also see the
Return the canonical version of DATE-STRING, in the format "MM/DD/YY HH:MM:SS". Example: <date::canonicalize <date>>produces: 05/26/13 03:16:56
Return the number of days in MONTH. MONTH is the name of a month, such as "Apr" or "april".
Return a string representation of the date from the time in TIME. If TIME is not supplied, it defaults to the current time. The format string consists of any characters you would like, with the following special sets being replaced by their corresponding elements of the date. Please note that case is significant:
Example: <date::format-time "DAY, MONTH DD, YYYY (DD-MM-YY) at hh:mm:ss">produces: Sunday, May 26, 2013 (26-05-13) at 03:16:56
Returns "true" if YEAR is a leap year.
Return the canonical long name of MONTH. MONTH is the name of a month, such as "Apr" or "april".
Return a date string represent the first second of the month specified by TIME. <set-var now = <time>> <set-var today= <date <get-var-once now>>> <set-var mstart = <date::month-start-string <get-var-once now>>> <pre> Now: <get-var-once today> Then: <get-var-once mstart> </pre>produces: Now: Sun May 26 03:16:56 2013 Then: Wed May 1 00:00:01 2013
Create a table representing the month found in TIME. Keyword argument HIGHLIGHT-DAYS is an array of day numbers that you would like to have highlighted in the month display. Keyword argument LINK-DAYS is an array of day numbers that should be linked to HREF in the month display. The arrays may have overlapping members. The keyword argument HREF is the document to go to when a linked day is clicked on -- it is passed the day, month, and year, as two digit fields in the POSTED package under the variable names DAY, MONTH, and YEAR. If keyword argument SHOW-YEAR is non-empty, the year is displayed next to the month name. Finally, you can control the formatting of each day by supplying a function which takes day, month, year, and keywords of highlight, and link. You pass the name of this function as the value of the keyword argument FORMATTER, and it is called for each day in the month to display. Example: <date::month-table
highlight-days="3
8" link-days="18
8" href=<thisdoc>>
produces:
Example: <defun myformat day month year &key highlight link>
<if <get-var-once link>
<concat <a href="<get-var-once link><cgi-encode day month year>">
<get-var-once day>
</a>>
<if <get-var-once highlight>
<prog <b><get-var-once day></b>>
<get-var-once day>>>
</defun>
<p>
<date::month-table
highlight-days="3" link-days="12" href=<thisdoc> formatter=myformat>
produces:
Display a table of COUNT months, centered around TIME.
TIME defaults to the current time, while COUNT defaults
to <date::month-table-centering-around>produces:
Populates the package PACK with the result of parsing STRING.
If STRING is passed, that string is used instead of <date>,
and should be the date in human readable format, just as
If no PACK is specified, returns an alist of the values instead.
Return the number of seconds in MONTH. MONTH is the name of a month, such as "Apr" or "april".
Return the number of seconds that have transpired between Jan 1, 1970 and DATE-STRING.
This interface is deprecated, and is replaced by the more robust
Display the number of seconds passed in SECONDS as a human readable string of text, representing elapsed time. For example: <date::seconds-to-human-readable 8734>produces: 2 hours, 25 minutes and 34 seconds
Return the canonical short name of MONTH. MONTH is the name of a month, such as "Apr" or "april".
Return the seconds since the epoch representing the date which is exactly the first second of the day which is COUNT days before the day represented by TIME. The epoch is defined as Jan 01, 1970, 00:00:00. TIME defaults to the current time.
Return the seconds since the epoch representing the date which is exactly the first second of the day which is COUNT days after the day represented by TIME. The epoch is defined as Jan 01, 1970, 00:00:00. TIME defaults to the current time.
Return the seconds since the epoch representing the date which is exactly the first of the month which is COUNT months before the month represented by TIME. The epoch is defined as Jan 01, 1970, 00:00:00. TIME defaults to the current time.
Return the seconds since the epoch representing the date which is exactly the first of the month which is COUNT months following the month represented by TIME. The epoch is defined as Jan 01, 1970, 00:00:00. TIME defaults to the current time.
Deprecated. Please use
Returns the current local time, as measured in seconds since the epoch (the change from 23:59:59, December 31, 1969 to 00:00:00 Jan 1, 1970).
If passed DATE-STRING, <time> calls
This is often useful as input to the
<date> ==> Wed Jul 3 17:14:53 1996
<date <add <time> <mul 60 60 10>>>
==> Thu Jul 4 03:14:57 1996
Edit Section
![]() The META-HTML Reference Manual V2.0 Copyright © 1995, 1998, Brian J. Fox Found a bug? Send mail to bug-manual@metahtml.org |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||