Time handling functions.
API version $Date: 2010-01-08 04:06:12 +0100 (Fri, 08 Jan 2010) $ (revision $Rev: 6075 (2010-01-17) $)
Since date indicates where functions or parameters have been added since the baseline of the API (TWiki release 4.2.3). The date indicates the earliest date of a Foswiki release that will support that function or parameter.
Deprecated date indicates where a function or parameters has been deprecated. Deprecated functions will still work, though they should not be called in new plugins and should be replaced in older plugins as soon as possible. Deprecated parameters are simply ignored in Foswiki releases after date.
Until date indicates where a function or parameter has been removed. The date indicates the latest date at which Foswiki releases still supported the function or parameter.
Convert string date/time string to seconds since epoch (1970-01-01T00:00:00Z).
$sDate
- date/time string
Handles the following formats:
Default Foswiki format
Foswiki format without time (defaults to 00:00)
Date separated by '/', '.' or '-', time with '.' or ':' Date and time separated by ' ', '.' and/or '-'
ISO format
ISO dates may have a timezone specifier, either Z or a signed difference in hh:mm format. For example:
If the date format was not recognised, will return 0.
$epochSeconds
epochSecs GMT
$formatString
twiki time date format, default $day $month $year - $hour:$min
$outputTimeZone
timezone to display, gmtime
or servertime
, default is whatever is set in $Foswiki::cfg{DisplayTimeValues}
$formatString
supports:
$seconds | secs |
$minutes | mins |
$hours | hours |
$day | date |
$wday | weekday name |
$dow | day number (0 = Sunday) |
$week | week number (ISO 8601) |
$month | month name |
$mo | month number |
$year | 4-digit year |
$ye | 2-digit year |
$http | ful HTTP header format date/time |
full email format date/time | |
$rcs | full RCS format date/time |
$epoch | seconds since 1st January 1970 |
$tz | Timezone name (GMT or Local) |
$isotz | ISO 8601 timezone specifier e.g. 'Z, '+07:15' |
Format a time in seconds as a string. For example, "1 day, 3 hours, 2 minutes, 6 seconds"
Convert string representing a time interval to a pair of integers representing the amount of seconds since epoch for the start and end extremes of the time interval.
$szInterval
- time interval string
in yacc syntax, grammar and actions:
interval ::= date { $$.start = fillStart($1); $$.end = fillEnd($1); } | date '/' date { $$.start = fillStart($1); $$.end = fillEnd($3); } | 'P' duration '/' date { $$.start = fillEnd($4)-$2; $$.end = fillEnd($4); } | date '/' 'P' duration { $$.start = fillStart($1); $$.end = fillStart($1)+$4; } ;an
interval
may be followed by a timezone specification string (this is not supported yet).
duration
has the form (regular expression):
P(<number><nameOfDuration>)+
nameOfDuration may be one of:
date
follows ISO8601 and must include hyphens. (any amount of trailing
elements may be omitted and will be filled in differently on the
differents ends of the interval as to include the longest possible
interval):
timezone is optional. Default is local time.
If the format is not recognised, will return empty interval [0,0].