Convert to date format

Hello -

I have an excel which has Dates. Sample: Aug 31, 2021

I want to search each date on a website using this kind of format. Sample: 08-31-2021

From: Aug 31, 2021
To: 08-31-2021

image

image

Hi

Use read range activity and it will automatically give the same
If not pls let know the format you are getting in studio so that we will mention the expression to get that format

Cheers @prititit

1 Like

Hi @prititit

Try the below Expression!

DateTime.ParseExact( YourConvertVariable, “MMM dd, yyyy”, System.Globalization.CultureInfo.InvariantCulture).ToString(“MM-dd-yyyy”)

Regards

Hello -

I’m using the row.Item(“Date”).ToString

Since I want to get the date from the excel.

I wanted to convert the date to this kind of format (08-31-2021)

hi @prititit

From the above post pass the row.item(“Date”) instead of yourconvertvariable.

Regards

1 Like

Thanks, @pravin_calvin :slight_smile:

1 Like

@prititit - Since your dateformat is generic…you can easily use cdate or datetime.parse…

  DateTime.Parse(row.("Date").ToString).tostring("MM-dd-yyyy")

OR

    Cdate(row.("Date").ToString).tostring("MM-dd-yyyy")

image

@prititit

Happy Learnings!

Regards
Calvin.

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