DateTime.FromText

Syntax

DateTime.FromText(text as nullable text, optional culture as nullable text) as nullable datetime

About

Creates a datetime value from a textual representation, text, following ISO 8601 format standard. An optional culture may also be provided (for example, "en-US").

  • DateTime.FromText("2010-12-31T01:30:00") // yyyy-MM-ddThh:mm:ss

Example 1

Convert "2010-12-31T01:30:25" into a datetime value.

DateTime.FromText("2010-12-31T01:30:25")

#datetime(2010, 12, 31, 1, 30, 25)

Example 2

Convert "2010-12-31T01:30" into a datetime value.

DateTime.FromText("2010-12-31T01:30")

#datetime(2010, 12, 31, 1, 30, 0)

Example 3

Convert "20101231T013025" into a datetime value.

DateTime.FromText("20101231T013025")

#datetime(2010, 12, 31, 1, 30, 25)

Example 4

Convert "20101231T01:30:25" into a datetime value.

DateTime.FromText("20101231T01:30:25")

#datetime(2010, 12, 31, 1, 30, 25)

Example 5

Convert "20101231T01:30:25.121212" into a datetime value.

DateTime.FromText("20101231T01:30:25.121212")

#datetime(2010, 12, 31, 1, 30, 25.121212)