Date and Time formatting from excel

Hello.

I’m assigning a row containing date from excel to a variable, such as:

Assign
birthday = row(“生年月日”).ToString

The row contains date in format of yyyy/MM/dd, but the output from the variable is yyyy/MM/dd hh:mm:ss.
What should I do to make it stay yyyy/MM/dd?

Please help.

Regards.

Try this

DateTime.ParseExact(“yourString”,“yyyy/MM/dd”,System.Globalization.CultureInfo.InvariantCulture)

Thanks,
Prankur

@PrankurJoshi Thank you for your fast reply!

Hmm… I am extracting the data from Data Table row though… Will it still be working without row().ToString ?

Regards

You have to use an Assign activity

image

It gives me error message box
err

Check the string value what you are getting, if possible paste it here

Like this

DateTime.ParseExact(row(“生年月日”).ToString,“yyyy/MM/dd”,System.Globalization.CultureInfo.InvariantCulture)

The actual value what you are reading from sheet

The actual value what you are reading from sheet

excel

Try this

Main.xaml (8.1 KB)

This will help you understand it better

1 Like

Hmm… The output still showed me the hh/mm/ss.

No it does not, see the output of write line Activity

It worked! thank you vry much!

2 Likes