DateTime.From

DateTime.From

Creates a datetime from the given value.

function (optional value as nullable any, optional culture as nullable any) as nullable any

Description

Returns a datetime value from the given value. If the given value is null, DateTime.From returns null. If the given value is datetime, value is returned. Values of the following types can be converted to a datetime value:

If value is of any other type, an error is returned.

Category

DateTime

Examples

Convert #time(06, 45, 12) to a datetime value.

DateTime.From(#time(06, 45, 12))

datetime(1899, 12, 30, 06, 45, 12)

Convert #date(1975, 4, 4) to a datetime value.

DateTime.From(#date(1975, 4, 4))

datetime(1975, 4, 4, 0, 0, 0)