O'Reilly logo

Asterisk: The Future of Telephony by Leif Madsen, Jared Smith, Jim Van Meggelen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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)

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required