login | register
Thu 04 of Dec, 2008 [01:23 UTC]

voip-info.org

Discuss [1] History

Asterisk func strptime

Created by: murf,Last modification on Mon 17 of Apr, 2006 [04:04 UTC]

Synopsis:

 Returns the epoch of the arbitrary date/time string structured as described in the format.

Description:

 STRPTIME(<datetime>|<timezone>|<format>)
This is useful for converting a date into an EPOCH time, possibly to pass to an application like SayUnixTime or to calculate the difference between two date strings.

Notes

  • *CLI> show function STRPTIME

Return value

Returns the string representing the unix time in seconds since the beginning of the epoch (Jan 1st, 1970)

Example

exten => s,1,Set(foo=${STRPTIME(2006-03-01 07:30:35|America/Chicago|%Y-%m-%d %H:%M:%S)}
should set foo to the value "1141219835"


See also





Comments

Comments Filter
222

333DOES NOT work on 64-bit CPUs, asterisk just hangs

by baji, Tuesday 09 of October, 2007 [01:26:59 UTC]
See 1.4.12 changelog and search for STRPTIME

http://svn.digium.com/view/asterisk/tags/1.4.12/ChangeLog?view=markup

Expected to be fixed when ast_mktime.c & ast_strptime.c are corrected in future releases.

Worked fine for me on a 32-bit CPU.