Convert datetime format

Hi
I want to convert date time format that date i extract from outlook email is “Tue, 15 Mar 2022 08:20:29 - 0400” this format to “03/15/2022 08:20:29” this format. Do you have any idea?
Thanks

Hi,

If we can ignore timezone information, the following will work.

DateTime.ParseExact(System.Text.RegularExpressions.Regex.Match(yourDateString,".*\d+:\d+:\d+").Value,"ddd, d MMM yyyy HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture).ToString("MM/dd/yyyy HH:mm:ss")

Regards,

@ahmad.mubarak

Try this.

        CDate(“Tue, 15 Mar 2022 08:20:29 - 0400”).ToString("MM/dd/yyyy HH:mm:ss")

Thanks for your help :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.