[TOC] [Prev] [Next] [Bottom]



<@DATETOSECS>, <@SECSTODATE>

Syntax

<@DATEOSECS DATE=date [FORMAT=format]>

<@SECSTODATE SECS=seconds [ENCODING=encoding] [FORMAT=format]>

Description

<@DATEOSECS> checks the entered date and, if valid, converts it into seconds using as a reference---midnight (00:00:00) January 1, 1970 (1970-01-01).

Conversely, <@SECSTODATE> checks the entered seconds and converts them to a date.

These tags support dates in the range 1970-2037.

Both tags handle ODBC, ISO, and some numeric formats.

If the date is entered incorrectly--wrong separators or wrong values for year, month, or day--the tag returns "Invalid date!".

The date attribute is mandatory. If no attribute is found while the expression is parsed, the tag returns "No attribute!".


! Note: When a two-digit year is given, the following centuries are assumed:

Value

Century

00-36

2000s

37-99

1900s

For example, a two-digit year of 99 is evaluated as 1999, and a two-digit year of 00 is evaluated as 2000.


Examples

<@DATETOSECS DATE=1970-01-01>

This tag returns "0", the number of seconds since January 1, 1970.

<@DATETOSECS DATE=2000-01-01>

This tag returns "946684800", the number of seconds since January 1, 1970.

<@SECSTODATE SECS=946684800>

This tag returns "2000-01-01", the date derived from the number of seconds. The example assumes a dateFormat of "%Y-%m-%d".

See Also

dateFormat, timeFormat, timestampFormat
Encoding Attribute
<@FORMAT>
Format Attribute
<@ISDATE>, <@ISTIME>, <@ISTIMESTAMP>
<@TIMETOSECS>, <@SECSTOTIME>
<@TSTOSECS>, <@SECSTOTS>



[TOC] [Prev] [Next] [Bottom]



docs@pervasive.com

Copyright © 1999, Pervasive Software. All rights reserved.