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



<@DATETOSECS>, <@SECSTODATE>

Syntax

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

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

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). For dates before this, the return values are negative.

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

All formats assume the Gregorian calendar. All years must be greater than zero.

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!".

Examples

<@DATETOSECS DATE=1970-01-01>

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

<@DATETOSECS DATE=1969-12-31>

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

<@SECSTODATE SECS=-86400>

This tag returns "1969-12-31", 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 © 1998, Pervasive Software Inc. All rights reserved.