Name
DateToTimestamp -- convert local date to timestamp (V7.1)
Synopsis
s = DateToTimestamp(d$[, isdst])
Function
This function can be used to get the timestamp for the date passed in d$. This string must be in Hollywood's standard date format, i.e. dd-mmm-yyyy hh:mm:ss. See CompareDates for details.

Note that the date that you pass to this function is interpreted as local time whereas the timestamp returned starts from UTC time, i.e. from the Unix epoch which starts on January 1st, 1970, 00:00:00 UTC. This means that passing 01-Jan-1970 00:00:00 will only return 0 if the local timezone is identical to the UTC timezone. On systems east of UTC, passing the 01-Jan-1970 00:00:00 will lead to an error because January 1st, 1970, 00:00:00, east of UTC means December 31st, 1969 UTC which cannot be represented in the Unix epoch.

The optional argument isdst specifies whether or not daylight saving time is active at the specified date. Normally, you don't have to specify this argument because Hollywood will automatically query this information from the timezone database. It is only necessary to pass this information in case the specified time is ambiguous, i.e. when switching from daylight saving time back to standard time, a certain period of time (typically an hour) is repeated in the night. In Germany, for example, clocks are set back from 3am to 2am when switching from daylight saving time to standard time. This means that the hour between 2am and 3am happens twice: Once in daylight saving time, once in standard time. The isdst argument allows you to specify which hour you are referring to.

To convert a timestamp back into a date, use the TimestampToDate() function. See TimestampToDate for details.

Inputs
d$
Hollywood date to convert to the timestamp format
isdst
optional: whether or not daylight saving time is active at the specified date (defaults to -1 which means that this information should be retrieved from the local timezone database)
Results
s
time in seconds that has elapsed since the Unix epoch or -1 if the specified date cannot be represented in Unix time

Show TOC