Convert date to specific format

Hi everyone i will get the input form excel sheet and i need to modify the date formates and write back to excel how can i do that

Example Input : 22-aug-2022 and more like this.

But, i need as output of this “dd.MM.yyyy”. This format.

Hi,

It’s same as the following topic. Can you try to use DateTime.ParseExact or CDate?

Regards,

Hi @Venkata_Swami

Basically your getting data from excel

1.take read range activity to read excel and pass in for each row activity

2.Inside the loop

Take assign activity and pass like this

CurrentRow(“yourcolumn”) = Cdate(yourcolumn).Tostring(“dd.MM.yyyy”)

3.At the end out of loop write to excel by write range workbook activity

Hope it will help

@Venkata_Swami

Hi @Venkata_Swami ,
you can try
Cdate(yourString).Tostring(“dd.MM.yyyy”)
regards,

Hi @Venkata_Swami

Input= "22-aug-2022"
Output=DateTime.ParseExact(Input,"dd-MMM-yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("dd.MM.yyyy")

Output is of Data type System.String.

Other way is

Input= "22-aug-2022"
Output= Cdate(Input).Tostring("dd.MM.yyyy")

Output is of Data type System.String.

Hope it helps

How can i write back to excel
@Yoichi

How can i write back to excel

@Praveen_Mudhiraj @Nguyen_Van_Luong1

Hi,

There are several ways to achieve it.

One of them, the following will help you.

Regards,

1 Like

Try this in assign activity inside the loop

CurrentRow(“yourcolumn”) = Cdate(yourcolumn).Tostring(“dd.MM.yyyy”)

At the end out off for each row use the write range workbook activity so it will change

@Venkata_Swami

Hi @Venkata_Swami ,
You have data table has row(“A”)
you can assign
row('A")=Cdate(row(“A”).ToString).Tostring(“dd.MM.yyyy”)
or write cell
with
Cdate(row(“A”).ToString).Tostring(“dd.MM.yyyy”)

my in/out


→ it will success with your input

my code

Convert Time.zip (11.0 KB)

hope it help,
regards,

Hi

U can learn all the Datetime conversion from here

Hope this helps

Cheers @Venkata_Swami

Hi @Venkata_Swami

For each row in excel
Assign:
row("DateColumn") = DateTime.ParseExact(row("DateColumn").ToString(), "dd-MMM-yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("dd.MM.yyyy")

You can try this xaml

Xaml :
DateFormat Forum.zip (2.1 KB)

output :
image

@Venkata_Swami

1 Like

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