Redigera

Dela via


todatetime()

Applies to: ✅ Microsoft FabricAzure Data ExplorerAzure MonitorMicrosoft Sentinel

Converts the input to a datetime scalar value.

Note

Syntax

todatetime(value)

Learn more about syntax conventions.

Parameters

Name Type Required Description
value scalar ✔️ The value to convert to datetime.

Returns

If the conversion is successful, the result will be a datetime value. Else, the result will be null.

Example

The following example converts a date and time string into a datetime value.

print todatetime("2015-12-31 23:59:59.9")

The following example compares a converted date string to a datetime value.

print todatetime('12-02-2022') == datetime('12-02-2022')

Output

print_0
true