STRPTIME(DatumZeit
|Zeitzone
|Format
)
Wandelt einen formatierten Datums/Zeit-String unter Berücksichtigung der Zeitzone in einen Unix-Timestamp um.
; Datum/Zeit im Format "JJJJ-MM-TT HH:MM:SS" in ${zeit} speichern: exten => 123,1,Set(zeit=${STRFTIME(${EPOCH},Europe/Berlin,%Y-%m-%d %H:%M:%S)}) ; ${zeit} wieder in einen Timestamp umwandeln: exten => 123,n,Set(timestamp=${STRPTIME(${zeit}|Europe/Berlin|%Y-%m-%d %H:%M:%S)}
Asterisk-Versionen:
| | | 1.4 |————————| 1.6 |————————
Interner Hilfetext zu dieser Funktion 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 described in the format. [Description] 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. Example: ${STRPTIME(2006-03-01 07:30:35|America/Chicago|%%%%Y-%%%%m-%%%%d %%%%H:%%%%M:%%%%S)} returns 1141219835
Differenz des internen Hilfetexts von Asterisk 1.2 zu 1.4: — in Asterisk 1.2 nicht vorhanden —
Differenz des internen Hilfetexts von Asterisk 1.4 zu 1.6:
--- in Asterisk 1.4 +++ in Asterisk 1.6 @@ -1,7 +1,7 @@ -= Info about function 'STRPTIME' =- [Syntax] - STRPTIME(<datetime>|<timezone>|<format>) + STRPTIME(<datetime>,<timezone>,<format>) [Synopsis] Returns the epoch of the arbitrary date/time string structured as described in the format. @@ -12,4 +12,4 @@ date strings. Example: - ${STRPTIME(2006-03-01 07:30:35|America/Chicago|%%%%Y-%%%%m-%%%%d %%%%H:%%%%M:%%%%S)} returns 1141219835 + ${STRPTIME(2006-03-01 07:30:35,America/Chicago,%%%%Y-%%%%m-%%%%d %%%%H:%%%%M:%%%%S)} returns 1141219835
Siehe auch. Abschnitt 98, „STRFTIME()
“
AMOOCON 2010
Noch kein Ticket? Dann wird es Zeit. Nur noch wenige Tage.
- Infos unter www.amoocon.de.
- twitter.com/AMOOCON