Asterisk cmd SayUnixTime

Synopsis

Says a date and/or time to the caller.

Syntax

SayUnixTime(unixtime,timezone,format)

Description

Uses some of the sound files stored in /var/lib/asterisk/sounds to construct a phrase saying the specified date and/or time in the specified format.

unixtime is the date/time to say, represented as a standard unix timestamp (number of seconds since 1 Jan 1970). If this parameter is omitted, the default value is the current date/time.

timezone specifies the timezone that the unixtime is in. If this parameter is omitted, the default value is the time zone of the computer. It sould be specified as a unix timezone (see your /usr/share/zoneinfo directory for a list of timezones known to your computer), for example, "Pacific/Samoa".

format is a string specifying in what way to say the date/time. It uses a format based on the strftime(3) unix system call, if you're familiar with that. If omitted, the default value is:

ABdY \'digits/at\' IMp

This would result in a phrase like this: "Monday January twenty first 2003 at seven fifty two p m". Note that the 'digits/at' part refers to the sound /var/lib/asterisk/sounds/digits/at.gsm, i.e. it is a relative pathname to a sound file.

SayUnixTime is Multi-Language-compliant. It will say the date/time in the language set by the channel or overriden with the SetLanguage command, if the localized sound files for that language are installed.

Format Codes

\'filename\' (1.4) filename (1.6+)filename of a soundfileIn Asterisk version 1.4 backslash and single ticks (\') around the filename are required (but not in version 1.6).
A or aDay of weekSaturday, Sunday, ..., Friday
B or b or hMonth nameJanuary, February, ..., December
d or enumeric day of monthfirst, second, ..., thirty-first
YYear
I(capital eye) or l(lower ell)Hour, 12 hour clockone, two, three, ..., twelve
HHour, 24 hour clock?, oh one, oh two, ..., oh nine, ten, eleven, ..., twenty-three
kHour, 24 hour clock?, one, two, three, ..., twenty three
MMinute?, oh one, oh two, ... fifty-nine
m (in CVS HEAD)Month numberSay number of month (first - twelfth)
P or pAM or PMay em / pee em
QDate"today", "yesterday" or ABdY
qDate"" (for today), "yesterday", weekday, or ABdY
R24 Hour, Minute 24 hour time, including minute (HM)
Sseconds
T24 Hour, Minute, Second 24 hour clock with minute and second (HMS)


(:question:) How does SayUnixTime render years? Is 2000 said as "two thousand" or "twenty hundred"? 2001 = "twenty oh one" or "two thousand and one"? 1975 = "nineteen seventy five" or "one thousand nine hundred and seventy five"?
  • answer: 2005 is said as "two thousand five".

(:question:) For times between midnight at 12:59 am, does %H say "zero zero" or "oh oh" or "zero" or "oh" or ...? Does %k say "zero" or "oh"?
  • answer: %k and %H both say "oh". %R seems to be the equivalent of %H%M.

(:question:) Does %M say "oh clock" or "zero" or "oh" or nothing or what, to mean zero minutes? Are 1 to 9 minutes said as "oh one" to "oh nine"? And so on, for the other format characters here.
  • answer: %M says "oh clock", "oh one" and so on.


Example

SayUnixTime(,EST5EDT,ABdY \'digits/at\' IMp)
Says the current time based on the US Eastern Standard Time or Eastern Daylight Time.

See also



Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ

Synopsis

Says a date and/or time to the caller.

Syntax

SayUnixTime(unixtime,timezone,format)

Description

Uses some of the sound files stored in /var/lib/asterisk/sounds to construct a phrase saying the specified date and/or time in the specified format.

unixtime is the date/time to say, represented as a standard unix timestamp (number of seconds since 1 Jan 1970). If this parameter is omitted, the default value is the current date/time.

timezone specifies the timezone that the unixtime is in. If this parameter is omitted, the default value is the time zone of the computer. It sould be specified as a unix timezone (see your /usr/share/zoneinfo directory for a list of timezones known to your computer), for example, "Pacific/Samoa".

format is a string specifying in what way to say the date/time. It uses a format based on the strftime(3) unix system call, if you're familiar with that. If omitted, the default value is:

ABdY \'digits/at\' IMp

This would result in a phrase like this: "Monday January twenty first 2003 at seven fifty two p m". Note that the 'digits/at' part refers to the sound /var/lib/asterisk/sounds/digits/at.gsm, i.e. it is a relative pathname to a sound file.

SayUnixTime is Multi-Language-compliant. It will say the date/time in the language set by the channel or overriden with the SetLanguage command, if the localized sound files for that language are installed.

Format Codes

\'filename\' (1.4) filename (1.6+)filename of a soundfileIn Asterisk version 1.4 backslash and single ticks (\') around the filename are required (but not in version 1.6).
A or aDay of weekSaturday, Sunday, ..., Friday
B or b or hMonth nameJanuary, February, ..., December
d or enumeric day of monthfirst, second, ..., thirty-first
YYear
I(capital eye) or l(lower ell)Hour, 12 hour clockone, two, three, ..., twelve
HHour, 24 hour clock?, oh one, oh two, ..., oh nine, ten, eleven, ..., twenty-three
kHour, 24 hour clock?, one, two, three, ..., twenty three
MMinute?, oh one, oh two, ... fifty-nine
m (in CVS HEAD)Month numberSay number of month (first - twelfth)
P or pAM or PMay em / pee em
QDate"today", "yesterday" or ABdY
qDate"" (for today), "yesterday", weekday, or ABdY
R24 Hour, Minute 24 hour time, including minute (HM)
Sseconds
T24 Hour, Minute, Second 24 hour clock with minute and second (HMS)


(:question:) How does SayUnixTime render years? Is 2000 said as "two thousand" or "twenty hundred"? 2001 = "twenty oh one" or "two thousand and one"? 1975 = "nineteen seventy five" or "one thousand nine hundred and seventy five"?
  • answer: 2005 is said as "two thousand five".

(:question:) For times between midnight at 12:59 am, does %H say "zero zero" or "oh oh" or "zero" or "oh" or ...? Does %k say "zero" or "oh"?
  • answer: %k and %H both say "oh". %R seems to be the equivalent of %H%M.

(:question:) Does %M say "oh clock" or "zero" or "oh" or nothing or what, to mean zero minutes? Are 1 to 9 minutes said as "oh one" to "oh nine"? And so on, for the other format characters here.
  • answer: %M says "oh clock", "oh one" and so on.


Example

SayUnixTime(,EST5EDT,ABdY \'digits/at\' IMp)
Says the current time based on the US Eastern Standard Time or Eastern Daylight Time.

See also



Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ

Created by: oej, Last modification: Wed 29 of May, 2013 (23:45 UTC) by JustRumours
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+