Different date format

date

Hello, the top 5 cells are in General and the bottom 4 are in Date format in excel. How do I change them to date/month/year?

Hi @helpplease

Use Format cells activity


Hi @helpplease

Try this syntax:

DateTime.Parse(CurrentRow("column name").ToString, System.Globalization.CultureInfo.InvariantCulture, DateTimeStyles.None)

Hope it helps!!

What do I type for the Range? Is there an example?

@helpplease

Read the excel
Take for each loop
Date_Format:String
Date_Format=CurrentRow(“Date”).ToString
Assign:
Format=“d-MM-yyyy”
DateTime var=
DateTime.ParseExact(dateString, format, CultureInfo.InvariantCulture)

@helpplease

Screenshot 2023-07-27 171831

it didn’t work

@helpplease
Can you check with the datatype by clicking the formatcells manually in the excel. It converted

the format did not change to day-month-year

@helpplease

Hi,
Can you try

Hi
My input


My output

My solution


Hope it help you,
Regards,
LNV

Thank you but what I want is to have a consistent format of the date as date-month-year.

The problem is that the top 5 rows are in date-month-year (28-09-2022) while the bottom 4 rows are month/date/year (9/9/2022).

@helpplease
Input


Output
image

@helpplease
Check with the above flow

Hi @helpplease

  1. Use Assign activity and use below syntax:
strinput= CurrentRow("Clock Date").ToString  (Datatype: System.String)
  1. Use assign activity and use below syntax:
arr_input= {"dd/MM/yyyy","dd-MM-yyyy"}     (DataType: Array(String))
  1. Use assign Acitivty:
var_DateTime= DateTime.ParseExact(str_Input1.ToString, arr_Input, System.Globalization.CultureInfo.InvariantCulture)     (Datatype: System.Datetime)
  1. Print it wherever you want to print using below condition:
var_DateTime.ToString("dd/MM/yyyy")

Check the below workflow with sample input:
Sequence.xaml (7.4 KB)

Hope it works!!

@helpplease

Have you tried this. If it’s working fine at your end please matk it as solution so that it will help others in solving their query.

Happy Automation :blush:
Regards.

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