How to convert dd-MMM-yy to yyyy.MM.dd format?

I have a column it contains 18-Sept-22 (Date format in Excel) and i have to convert that date to 2022.09.18.
In my workflow am reading that excel and passing it in a for each row data table, am getting value as 4490.
So any one please help in this regards…

Hello @vanithavs

You can use Modify date activity.

Thanks

@vanithavs
The date column may be in Text format, So you are facing that issue

Try this to convert your date format.

DateTime.ParseExact("18-Sep-22","dd-MMM-yy",System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy.MM.dd")

Hi @vanithavs

Yo can try with Format Cells activity

Check out the Workflow

FilterDate.xaml (14.9 KB)

image

Output

image

Regards
Gokul

The date column is in date format in Excel, so that am getting value 4490 in for each row. that’s why am not able to convert to correct date format.

While using the read range of the worksheet, kindly check the Properties of PreserveFormat and try again.
image

Hi,
Hi,
while reading the Datatable in Readrange Activity.
Enable “PreserveFormat” in Option in Property Panel.

So it will Get perserve text format, then u can use normally

use For Each Row in Data Table
inside the For each
Assign=>
Str1=(Cdate(currentRow(“ColumnName”).ToString)).Tostring(“yyyy.MM.dd”)

Regards,
Harivishnu

Hello, @vanithavs Check the below workflow

Example.zip (10.4 KB)

input

Input

output

output

we assume that there was maybe a copy paste cut off from the number value. We do see more often this sceanrio when excel read range from Workbook (not the Excel Application Scope) was done and we reveived the number value for the dates. Maybe you can confirm this implementation detail (Weokbook vs. EAS)

In such case we do have the date as OADate value and can convert as following:
grafik

the value form the row column we can handle and parse into an int32 as following:
grafik

DateTime.FromOADate(CInt(yourRowVar(ColNameOrIndex).TosString().Trim())).ToString("yyyy.MM.dd")

For a further analysis we recommend to debug, explore the datatable within the different debug panels and try your prototypes within the immediate panel

Have you check this above XAML file @vanithavs

Regards
Gokul