How to convert a String value from current row in excel to date time variable

Hi all,

How to convert a String value from current row in excel to date time variable.

I’m taking each row from a dt as a string variable how to convert that to date time.

Example string value: 12/12/2022 21:00:00 = string from each row excel dt.

I want this value in datetime format MM/dd/yyyy HH:00:00, the above values must be passed as date and time varaiable too.

Output value 12/12/2022 21:00:00 = datetime

Thanks in advance

on of a few options:
grafik

Along CDate other conversion options are

DateTime.Parse / ParseExact
Convert.ToDateTime

1 Like

@VishnuMV

Another method

Datetime.parseexact(currentrow(“datecolumn”).tostring,”MM/dd/yyyy hh:mm:ss”,system.Globalization.culturalinfo.InvariantCulture)

Cheers

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