NaviServer - programmable web server
4.99  5.0

[ Main Table Of Contents | Table Of Contents | Keyword Index ]

ns_parsetime(n) 5.0.0a naviserver "NaviServer Built-in Commands"

Name

ns_parsetime - Return an element from the time structure list

Table Of Contents

Synopsis

Description

ns_parsetime sec time
ns_parsetime min time
ns_parsetime hour time
ns_parsetime mday time
ns_parsetime mon time
ns_parsetime year time
ns_parsetime wday time
ns_parsetime yday time
ns_parsetime isdst time

This command takes a nine-element Tcl list as time representing the Unix struct tm structure (as would be returned from ns_gmtime or ns_localtime) and based on option, returns an element from the list. The valid options are: sec, min, hour, mday, mon, year, wday, yday, isdst. The options are listed in order of the actual elements in the Tcl list itself.

EXAMPLES

 % set time [ns_localtime]
 18 45 16 4 0 114 6 3 0
 
 % ns_parsetime year $time
 114
 
 % expr {[ns_parsetime year $time] + 1900}
 2014

See Also

ns_gmtime, ns_localtime

Keywords

time