Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

SQL.ConvertDateTimeToSQL

Converts a date/time/timestamp to SQL text.

Component Version macOS Windows Linux Server iOS SDK
SQL 11.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "SQL.ConvertDateTimeToSQL"; Value )   More

Parameters

Parameter Description Example
Value The date, time or timestamp value.
Text or number are converted by FileMaker to get a timestamp.
Get(CurrentDate )

Result

Returns text or error.

Description

Converts a date/time/timestamp to SQL text.
Localization of FileMaker time and date formats applies. Examples below are in German format.

Similar function is used internally by SQL.SetParamValue, SQL.SetParamAsDate, SQL.SetParamAsDateTime and SQL.SetParamAsTime to convert values automatically for you.

Examples

Query date:

MBS( "SQL.ConvertDateTimeToSQL"; Get(CurrentDate ))

Example result: 2021-04-27

Query time:

MBS( "SQL.ConvertDateTimeToSQL"; Get(CurrentTime ))

Example result: 15:45:26

Query timestamp:

MBS( "SQL.ConvertDateTimeToSQL"; Get(CurrentTimestamp ))

Example result: 2021-04-27T15:45:44

Query with text:

MBS( "SQL.ConvertDateTimeToSQL"; "27.04.2021 15:46:20,123456" )

Example result: 2021-04-27T15:46:20.123456

Query with number:

MBS( "SQL.ConvertDateTimeToSQL"; 63346256456 )

Example result: 2008-05-13T06:20:56

See also

Release notes

Blog Entries

This function checks for a license.

Created 27th April 2021, last changed 3th May 2021


SQL.ConvertDateTimeFromSQL - SQL.Disconnect