Skip to main content

Notifications

Date time custom formats

Sometime we have to deal with custom date formats, scenarios like you want to append any custom date format in the file name. In such case we can use DateTime.ParseExact() method through .NET Interop:

Ax example can be :

System.Globalization.CultureInfo culture = System.Globalization.CultureInfo::get_InvariantCulture(); utcDateTime dt = System.DateTime::ParseExact( '10/17/2014 0:00', 'MM/dd/yyyy H:mm', culture);

Parameters details about DateTime.ParseExact():

s String

A string that contains a date and time to convert.

format String

A format specifier that defines the required format of s. For more information, see the Remarks section.

provider IFormatProvider

An object that supplies culture-specific format information about s.

Returns

DateTime

An object that is equivalent to the date and time contained in s, as specified by format and provider.


This was originally posted here.

Comments

*This post is locked for comments