Function
getdow
Purpose
Gets the day of the week for a given time.
Return Type
str
Syntax
getdow( time ( <time> ) )
Arguments
<time> Time string of up to 14 characters in the following format.
yyyymmddHHMMss
yyyy 4 digit year
mm 2 digit month, 01 thru 12
dd 2 digit day, 01 thru 31
HH 2 digit hour on 24-hour basis, 00 thru 23
MM 2 digit minute, 00 thru 59
ss 2 digit second, 00 thru 59
Ending characters may be dropped. Following examples illustrate.
"2010072312" July 23, 2010, 12:00:00 noon
"201007231210" July 23, 2010, 12:10:00 PM
"201007231310" July 23, 2010, 01:10:00 PM
"2010072313105" July 23, 2010, 01:10:05 PM
(Please note that "2010072313105" is interpreted as July 23, 2010, 01:10:05 PM,
and NOT as July 23, 2010, 01:10:50 PM.)
If this argument is not specified, the current time will be used.
Return Value
The day of the week for the time specified by <time>.
Stream Input
Streams apply to commands and not to functions.
Stream Output
Streams apply to commands and not to functions.
Stream Error
Streams apply to commands and not to functions, although any errors
will be written here.
Description
This function gets the day of the week for the given time. If the input argument <time>
is not specified, or is empty, the day of the week for the current time will be returned.
Restrictions
Times before year 1977, or after year 2036 (these limits are processor-dependent), are not supported.
An appropriate error will be produced.
All system functions are declared as global, and can not be redeclared (overloaded).
Valid Examples
echo getdow(time("20100601170000"))
Will get the day of the week for June 1, 2010.
echo getdow(time("20100601"))
Will get the day of the week for June 1, 2010.
echo getdow()
Will get the day of the week for today. Since the value for argument time has not been provided,
the default value of the current time will be used.
Here is a fun example. Let's say, your birthday is March 17th. The following script will show
you on what day of the week your birthday falls in each of the next 10 years.
var int year, index
set $year = makeint(str({ chex "4]" gettime() }))
while ($index < 10)
do
echo ($year+$index) "\t" getdow(time(makestr(int($year+$index))+"0317"))
set $index = $index + 1
done
Invalid Examples
echo getdow(time(20100101000000))
Will produce an error. The argument time needs a string value. The value supplied
(20100101000000) is integer. An integer value can not be automatically converted to
a string value.
var bool bdow
set $bdow = getdow(time("20100601170000"))
Will produce an error. The getdow function returns a value of type str. It can not
be automatically converted to bool. (See help page for conversion.)
The following will, however, work.
var str sdow
set $sdow = getdow(time("20100601170000"))
See Also
gettime
addtime
difftime
var
conversion
|
© 2008-2013, biterScripting.com. All rights reserved.
biterScripting, biterScript, biterBrowser, biterMobile, biterScripting.com, FVA (Forward Variable Assignment) are trademarks of biterScripting.com. Is it biterScripting-compatible ? is a service mark of biterScripting.com.
Explorer, Unix, Windows are trademarks, service marks or other forms of intellectual property of their respective owners.
|