All Manuals > LispWorks® User Guide and Reference Manual > 45 The SQL Package

decode-to-db-standard-date

decode-to-db-standard-timestamp Functions

Summary

Converts a Lisp universal time to standard SQL DATE and TIMESTAMP.

Package

sql

Signatures

decode-to-db-standard-date universal-time &key stream quoted => date

decode-to-db-standard-timestamp universal-time &key stream quoted => timestamp

Arguments
universal-time
A universal time.
stream
nil, t, or an output stream.
quoted
A boolean.
Values
date
A string or nil.
timestamp
A string or nil.
Description

The functions decode-to-db-standard-date and decode-to-db-standard-timestamp convert universal-time to a SQL DATE or TIMESTAMP respectively.

The format of the date is YYYY-MM-DD.

The format of the timestamp is YYYY-MM-DD HH:MM:SS.

stream is interpreted as in cl:format. If stream is nil then the string representing the DATE or TIMESTAMP is returned, otherwise the string is written to the stream and nil is returned. The default value of stream is nil.

When quoted is true, the date or timestamp is quoted (by single quote). This is useful when these functions are used while building a SQL command string, and the result should be interpreted as a string. The default value of quoted is nil.

See also

encode-db-standard-date
encode-db-standard-timestamp
connect
23.6 Working with date fields


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:56