STRPTIME(datetime|timezone|format)
(beginning Asterisk 1.4)
Converts a formatted date and time string into a Unix timestamp.
; Save the date/time in the format YYYY-MM-DD HH:MM:SS in the variable $
{time}:
exten => 123,1,Set(time=${STRFTIME(${EPOCH},America/Los_Angeles,"%Y-%m-%
d %H:%M:%S")})
; Convert ${time} into Unix time:
exten => 123,n,Set(timestamp=${STRPTIME(${time}|America/Los_Angeles|%Y-%
m-%d %H:%M:%S)}
|
|
|
Internal help for this application in Asterisk 1.4: -= Info about function 'STRPTIME' =-
[Syntax]
STRPTIME(<datetime>|<timezone>|<format>)
[Synopsis]
Returns the epoch of the arbitrary date/time string structured as descri
bed in the format.
[Description]
This is useful for converting a date into an EPOCH time, possibly to pas
s to
an application like SayUnixTime or to calculate the difference between t
wo
date strings.
Example:
${STRPTIME(2006-03-01 07:30:35|America/Chicago|%Y-%m-%d %H:%M:%S)} ret
urns 1141219835
diff output to internal help in Asterisk 1.2: -- not available in Version 1.2 -- |
See also.
the section called “STRFTIME()”