Extract datetime variable from a string, "20200408045500"

Hi All,

I have variable from excel in the format “20200408045500”.
Date from this variable is in the format YYYYMMDDHHMMSS
I want to convert it to dateTime Variable.
Please help

Hi @mohitkumar.gupta

Check this Convert string to date time

For the time, just add “hh:mm:ss”


1 Like

in Assign,
Datetime YourDT = Datetime.ParseExact(YourStr, “yyyyMMddhhmmss”, nothing)


@mohitkumar.gupta Try this :
yourDateVar = DateTime.ParseExact(yourDateStr,“yyyyMMddHHmmss”,System.Globalization.CultureInfo.InvariantCulture)

Note that the date will be in the format MM/dd/yyyy HH:mm:ss


it works, Thanks @Dongjin_Lee

@supermanPunch it works, Thanks

1 Like

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