Why is showing like that?

Date Error
When i was write range in excel file data from website its come wrong data, In want my data same that is dd/mm/yy but its show mm/dd/yy and other data is come in wrong way?

Hi @Neeraj_Gupta1

What you are getting the format is through data scraping from website

  1. You need to change the entire values in a column to a proper format
    3.then write to excel

Is this your are expecting

not data scraping is using write range

@Neeraj_Gupta1

can you please explain more clear about what you are using

If you want to change the format of dates before writing

Let me know

@Neeraj_Gupta1

Please use format cell activity and change the format of the excel cells…its the excel formatting issue

Cheers

I Assume,In that case you can format the date row using
DateTime.ParseExact(currentRow(“Date”).ToString(), “MM/dd/yyyy HH:mm:ss”, System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)

give it a try and let us know @Neeraj_Gupta1

Hi,

When you extract the date data from the website make sure you identify the date format it’s in. If it’s in a different format (e.g mm/dd/yy) you’ll need to convert it to the desired format
Use the DateTime.ParseExact method in UiPath to convert the extracted date into the desired format.

Example:
extractedDate = “08/19/23”
convertedDate = DateTime.ParseExact(extractedDate, “MM/dd/yy”, System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yy”)

how to do??? guide us

Where i change please guide???

@Neeraj_Gupta1

your using get text activity to get the date from the website

or how your are getting the date

use this

arr_dates={“dd/MM/yyyy”,“MM/dd/yyyy”,“MM-dd-yyyy”,“dd-MM-yyyy”}

str_dates is the string output which you get from the website,What ever the format it comes we are converting into our required format. using below syntax

DateTime.ParseExact(Str_dates,arr_dates,System.Globalization.CultureInfo.InvariantCulture).ToString(“mention your format here”)

Assign your extracted date in one variable

Example

extractedDate = “08/19/23”

Again use assign and convert your extracted date in your format which you need

Example

convertedDate = DateTime.ParseExact(extractedDate, “MM/dd/yy”, System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yy”)

Hi @Neeraj_Gupta1

After extraction you will. Get output as Extractdatatable …right

You can pass that variable in for each row in DataTable activity

Inside loop you can use the if activity

If - condition = Not string. Isnullorempty

Then section - take assign activity

Currentrow(“columnname”) =Convert.todatetime(currentrow(“columnname”)). Tostring (“dd/MM/yyyy”)

Else nothing you can do

It will replace the all date values that your excepting… Let me know if it working or not

Cheers…!

Hi @Neeraj_Gupta1 ,

Maybe an initial check/Understanding can be done from Debugging and checking what is the format of the Dates in the Datatable that is extracted, if it appears to be fine/all in same format, then the issue must be within the Excel Sheet format, So you could change the Excel format beforehand (Standardizing) as required or Perform Format Cells activity after the Data is written to the Excel sheet.