Name

DateTime() — Says the specified time in a custom format

Synopsis

    DateTime([unixtime][,timezone[,format]])

Says the time unixtime, in the time zone specified by timezone, according to the format specified in format.

The unixtime argument is the time, in seconds, since January 1, 1970. It may be negative for dates before 1970. unixtime defaults to the current time.

The timezone argument specifies the time zone of the specified time. See /usr/share/zoneinfo/ for a list of valid time zones. timezone defaults to the current time zone of the Asterisk server.

The format argument specifies which parts of the date and time should be read. See voicemail.conf for formatting options. format defaults to "ABdY 'digits/at' IMp".

Returns 0, or -1 on hangup.

    ; today's date and time
    exten => 123,1,DateTime()
    ; today's date
    exten => 124,1,DateTime(,,BdY)
    ; A specified date
    exten => 125,1,DateTime(871624800,,BdY)

Get Asterisk: The Future of Telephony now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.