NaviServer Built-in Commands – 5.0.5
ns_localtime - Return local time as a Tcl list
This command returns the current local time as a Tcl list. The time is computed using the system's current local timezone. The returned list has the same field order as the Unix struct tm time structure.
Returns a nine-element Tcl list with the following fields:
seconds: Seconds after the minute, in the range 0 to 59.
minutes: Minutes after the hour, in the range 0 to 59.
hours: Hours since midnight, in the range 0 to 23.
dayofmonth] Day of the month, in the range 1 to 31.
monthofyear: Month of the year, in the range 0 to 11. January is 0.
year] Years since 1900.
dayofweek: Day of the week, in the range 0 to 6. Sunday is 0.
dayofyear: Day of the year, in the range 0 to 365. January 1 is 0.
isdst: Daylight saving time flag. The value is positive when daylight saving time is in effect, zero when it is not in effect, and negative when the information is not available.
% ns_localtime 1 58 14 5 6 126 0 185 1
The example above represents local time with second 1, minute 58, hour 14, day of month 5, month 6, year 126, day of week 0, day of year 185, and daylight saving time in effect. Since the month is zero-based and the year is relative to 1900, this corresponds to July 5, 2026.