Table of contents
TOC
Collapse the table of content
Expand the table of content

DateTime.FromText

Owen Duncan|Last Updated: 4/19/2018

About

Returns a DateTime value from a set of date formats and culture value.

DateTime.FromText(dateTime as nullable text, optional culture as nullable text) as nullable date  

Arguments

ArgumentDescription
dateTimeThe text value to convert.
CultureA text value corresponding to the culture values supported on your version of Windows, such as "en-US". If the culture is not specified, the current user culture is used. For a list of culture names, see National Language Support (NLS) API Reference.

DateTime formats

  • YYYY-MM-DDThh:mm

  • YYYYMMDDThh:mm

  • YYYY-MM-DDThh:mm:ss

  • YYYYMMDDThh:mm:ss

  • YYYY-MM-DDThh:mm:ss.nnnnnnn

  • YYYYMMDDThh:mm:ss.nnnnnnn

Terms

  • Y = years

  • M = months

  • D = days

  • h = hours

  • m = minutes

  • s = seconds

  • n = fractional seconds

Example

DateTime.FromText("2010-12-31T01:30:00") equals YYYY-MM-DDThh:mm:ss  
© 2018 Microsoft