Converting a Sculptor time & date to Internet standard

gmt_std_format()

Convert a Sculptor time & date to Internet standard


SYNTAX

gmt_std_format(time&date_value)

Convert the supplied value to an Internet standard GMT time and date value.

The value supplied must be a Sculptor time and date field with the logical type td. This field type stores the time and date as seconds counting from midnight on 01/01/1970. See Logical types (date and time).

This function is useful for assigning an expiration date value (date_value) to a cookie stored on the user’s machine, defining the valid lifetime of the cookie. The cookie is stored via the put_cookie() function, using the option “EXPIRES=*date_value*”.

The Sculptor system variable sys.SysTime, which stores the current system time in seconds (GMT), can often be used in conjunction with this function, for purposes such as adding a number of days to the current day. See the example below.

The result of the conversion is returned as a string.


EXAMPLE

Add three days to the current date before conversion:

!temp DateField,,i4/td
!temp DateString,,a30

     tmp.DateField = sys.SysTime + (3600 * 24 * 3)
     tmp.DateString = gmt_std_format(tmp.DateField)

RELATED TOPICS

Creating web pages with Sculptor

Internet functions