Hey community, I have a problem I developped a workflow that has as an input a data containing date column dd/mm/yy but after executing the workflow the format date become mm/dd/yy
but I want to keep the same format at beginning HELP
Hey community, I have a problem I developped a workflow that has as an input a data containing date column dd/mm/yy but after executing the workflow the format date become mm/dd/yy
but I want to keep the same format at beginning HELP
Hi @BlueBird1
At the time of writing the data, you can explicitly convert the mm/dd/yy formatted data to your desired pattern & write it. You can use this expression for the same:
yourDateValue.ToString(“dd/MM/yy”)
Hope this helps,
Best Regards.
Hi @BlueBird1
DateTime.ParseExact(yourStringVariable, {"M/d/yy","dd/MM/yy","d/M/yy","MM/dd/yy","MM/dd/yy hh:mm:ss"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("MM/dd/yy")
Regards!
Actually I didn’t write any dataTable, M just workinng with an excel file and I want to keep the same input format
If you want to keep the data format intact from the time of reading the data, you can use a property called Preserve Format in the Read Range activity.
Selecting this check box keeps the formatting of the cell that you want to read. By default, the check box is cleared.
Hope this helps,
Best Regards.
I will try tthis method and I’ll let u know
Hi @BlueBird1
By Default format of date time in UiPath is MM/dd/yyyy only.
So i you want to Same format after getting your datatable u have to Convert the format with below expression
DateTime.ParseExact(YourVariable,"dd/MM/yyyy",System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy")
Thanks
VP
should I put in the bloc variable the name of my column?
@Vishnuraj_Pandiyarajan2 I tried what you said and it return this error: Assign: String ‘DATE_TRAITEMENT’ was not recognized as a valid DateTime.
Does the text “DATE_TRAITEMENT” appear anywhere in your column containing the dates? Is it the name of the column header or a variable in your workflow?
Yes it’s the header
Ok so that means the header text is also being fed into the function to parse as date. Can you read the data treating the first row as the header? Just double check that the “A des en-tetes” checkbox is checked.
it’s already checked
Hi @BlueBird1 ,
So here are the required steps:
DateTime.ParseExact(CurrentRow("DATE_TRAITEMENT").ToString, "d/M/yyyy", System.Globalization.CultureInfo.InvariantCulture)
Just before writing it into an Excel sheet, you can transform the data. Use the Invoke Code activity like this:
Keep the Edit Arguments panel like this:
And, paste this code in the Edit Code Panel:
io_dt.AsEnumerable.ToList.ForEach(Sub(row)
row(“DATE_TRAITEMENT”) = DateTime.ParseExact(row(“DATE_TRAITEMENT”).ToString,"dd/MM/yyyy", Globalization.CultureInfo.InvariantCulture).ToString("MM/dd/yyyy")
End Sub)
Hope this helps,
Best Regards.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.