ns_buildsqldate
Overview
Build an SQL date value from specified month, day, and year
Syntax
ns_buildsqldate month day year
Description
ns_buildsqldate returns an SQL date value 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 SQL date value can be used in an SQL statement. You may need to use ns_dbquotevalue to prepare the date value for use in SELECT queries.
Example
set thedate [ns_buildsqldate "January" "28" "1942"]
ns_db dml $db \
"insert into mytable (datefield) values ('$thedate')"