Nóta
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as shíniú isteach nó eolairí a athrú.
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as eolairí a athrú.
Syntax
DateTime.From(value as any, optional culture as nullable text) as nullable datetime
About
Returns a datetime value from the given value. An optional culture may also be provided (for example, "en-US"). 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:
text: Adatetimevalue from textual representation. Refer to DateTime.FromText for details.date: Adatetimewithvalueas the date component and12:00:00 AMas the time component.datetimezone: The localdatetimeequivalent ofvalue.time: Adatetimewith the date equivalent of the OLE Automation Date of0as the date component andvalueas the time component.number: Adatetimeequivalent of the OLE Automation Date expressed byvalue.
If value is of any other type, an error is returned.
Example 1
Convert #time(06, 45, 12) to a datetime value.
Usage
DateTime.From(#time(06, 45, 12))
Output
#datetime(1899, 12, 30, 06, 45, 12)
Example 2
Convert #date(1975, 4, 4) to a datetime value.
Usage
DateTime.From(#date(1975, 4, 4))
Output
#datetime(1975, 4, 4, 0, 0, 0)