Change date format from mm/dd/yyyy to dd/mm/yyyy

Hello,

I have to copy from Excel to Browser different dates. The format date in excel is dd/mm/yyyy, however when I use Type Into to write the date in the browser, it writes as mm/dd/yyyy: I tried different options that I read in the forum but its still not working.

Could you help me please?

@NDG
ensure following:
grafik

give a try on:

DateTime.ParseExact(YourExcelValue.Substring(0,10),"MM/dd/yyyy", CultureInfo.InvariantCulture).toString("dd/MM/yyyy")

in case of the excelvalue comes from a datatable (e.g. read range) use:
yourRowVarName(ColNameOrString).toString.Trim.Substring(0,10)

Hello,

I have System.Globalization in imports.

And the excel value comes from a datatable which the variable is called “FechaCambio”
So, I have to write in TypeInto activity: FechaCambio(ColNameOrString).toString.Trim.Substring(0,10) ??

@NDG
you are close to success:
as you want to access the particular row, this info is also needed

so give us more details on your flow or as mentioned

  • on datarow base: yourRowVarName(ColNameOrString).toString.Trim.Substring(0,10)
  • on datatable base: FechaCambio.Rows(YourRowIndex)(YourColNameOrIndex).toString.Trim.Substring(0,10)

Sorry, I’m a little bit lost.

I have an Excel with two columns. In one column I have a code and in the other one (Called FechaCambio) I have a date, so I have to introduce that code in browser and then introduce the date.

What I did to introduce the date is ReadRange and then use TypeInto activity wirting row(“FechaCamio”).ToString as text. However, although in Excel the format date is dd/MM/yyyy, in browser it is wrote as MM/dd/yyyy.

So, in which activity I have to write what you said? Do I have to add some activities?

@NDG
give try on

DateTime.ParseExact(row("FechaCamio").Substring(0,10),"MM/dd/yyyy", CultureInfo.InvariantCulture).toString("dd/MM/yyyy")

use it in a type into.
Otherwise show us some screenshots from your flow

@NDG

Check as below for your reference
https://forum.uipath.com/t/convert-date-time-format-tutorial/242670/2

Hope this helps you

Thanks

Cpying this in type into activity I can’t execute the process because this error.

I tried what you say in the tutorial and this error appears.

@NDG,

Try with this

String requiredDate = DateTime.ParseExact(yourDate, "dd/mm/yyyy", System.Globalization.CultureInfo.InvariantCulture).Tostring("mm/dd/yyyy")

Kindly note: MM - Month, mm = minutes

@NDG
ensure following:
when a variable is of datatype DataTable then accessing a columnvalue is done by:
DatatableVar.Rows(RowIndex)(ColumnNameOrIndex)

when a variable is of datatype Datarow then accessing columnvalue is done by:
DataRowVar(RowIndex)(ColumnNameOrIndex)

the screenshot shows some missmatches. The part of For each row is important for further help.
Help on the basics are available by courses from the Academy: https://academy.uipath.com

@NDG

Can you output the datatable? use Output Datatable activity and place a messagebox to view your content

If the Date content is coming as Number then check below for your reference
https://forum.uipath.com/t/tutorial-convert-number-to-date-format/249171/3

If not share the output screenshot

Thanks

Hello,
In this video I do a lot of stuff with DateTime:

20:05 DateTime to string in multiple ways
23:00 AddDays get DayofWeek
25:40 Convert from String to DateTime
26:20 Compare DateTime

Thanks,
Cristian Negulescu