Xbasic
SQL_DATE Function
Syntax
Formatted_Date as C = SQL_Date(D date [,N option [, N option2]])
Formatted_Date as C = SQL_Date(T date [,N option [, N option2]])
Arguments
- dateDate Time
A date value.
- optionNumeric
Default = 1. If 1, the date will be formatted to include curly braces { } around the date. If 2, no curly braces will be included.
- option2Numeric
Default = 1.
Returns
- Formatted_DateCharacter
Returns a formatted date string.
Description
Takes a date or time value and returns a character date or date-time string using the format for Alpha Portable SQL - {yyyy-mm-dd}
Discussion
The SQL_DATE() function generates a character string with the format: {YYYY-MM-DD}.
Example
date = date() now = now() ? sql_date(date) = "{2019-04-12}" ? sql_date(date, 2) = "2019-04-12" ? sql_date(now) = "{2019-04-12 13:14:33.577}" ? sql_date(now,1,1) = "{2019-04-12 13:14:33.577}" ? sql_date(now,2,2) = "2019-04-12 13:14:33 577000"
If you are building SQL statements, you should use SQL::Arguments to insert dates into queries.
See Also