ns_buildsqldate - SQL date and time manipulation commands
The following commands build SQL dates and timestamps for inclusion in SQL queries.
This command builds a SQL date string out of the specified month, day, and year. The month can be the month number (1 - 12) or the full, capitalized month name (January, February, ..., December). The day must be a number from 1 - 31, and the year must be a 4-digit year (e.g., 1957). An error is returned if any of the argument values are invalid. The resulting string can be used in an SQL statement.
This command returns a timestamp value that encodes the local time in ANSI SQL format (YYYY-MM-DD hh24:mm:ss).
% ns_buildsqldate "01" "15" "1929" 1929-01-15
% ns_buildsqldate "13" "31" "2000" Invalid date: 13 31 2000 while executing ...
% set thedate
% ns_localsqltimestamp 2004-06-22 23:00:27
This command is equivalent to the following:
% ns_fmttime ns_time "%Y-%m-%d %H:%M:%S"
% clock format ns_time -format "%Y-%m-%d %H:%M:%S"