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

NextPrevUpTopContentsIndex

decode-to-db-standard-date

decode-to-db-standard-timestamp

Functions
Summary

Convert Lisp universal time to standard SQL DATE and TIMESTAMP.

Package

sql

Signature

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-db-standard-date and decode-db-standard-timestamp take a Lisp universal time and convert it 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
Working with date fields


LispWorks User Guide and Reference Manual - 20 Sep 2017

NextPrevUpTopContentsIndex