Hello…
I have “Date” column which contains date’s as shown below…
Date
4/4/2022
11/4/2022
7/4/2022
20/4/2022
I want the output as…
04/04/2022
11/04/2022
07/04/2022
20/04/2022
Please help me…
Thanks in advance…
Hello…
I have “Date” column which contains date’s as shown below…
Date
4/4/2022
11/4/2022
7/4/2022
20/4/2022
I want the output as…
04/04/2022
11/04/2022
07/04/2022
20/04/2022
Please help me…
Thanks in advance…
Hi,
Can you try the following?
Parse DateTime
DateTime.ParseExact(yourString,"d/M/yyyy",System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy")
Regex
System.Text.RegularExpressions.Regex.Replace(yourString,"\b(\d)\b","0$1")
Regards,
I have a “Date” Column which contains date’s as shown below…
Date
4/4/2022 00:00:00
11/4/2022 00:00:00
16/04/2022
7/4/2022 00:00:00
20/04/2022
Here… for first 2 rows
CDate(row(“Date”).ToString).ToString(“dd/MM/yyyy”) is working…
But when it comes to 3rd row it is throwing an error.
So…
I have used
DateTime.ParseExact(CDate(row(“Date”).ToString).ToString(“dd/MM/yyyy”), “dd/MM/yyyy”, System.Globalization.CultureInfo.InvariantCulture)
The above code is also working for first 2 rows and throwing error when it comes to 3rd row.
Please help me…
Thanks in advance.
Hi,
Can you share output of row(“Date”).ToString
for 3rd row using WriteLine activity?
Regards,
Hi,
The output was…
Execution started for file: Main
BRS_Process_2022 execution started
11/04/2022 00:00:00
11/04/2022 00:00:00
16/04/2022
BRS_Process_2022 execution ended in: 00:00:03
Regards,
Hi,
Can you try the following expression?
DateTime.ParseExact(row("Date").ToString,{"d/M/yyyy","d/M/yyyy hh:mm:ss"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("dd/MM/yyyy")
Regards,
Hello @Yoichi
Thanks a lot…It’s working fine.
But I’m facing some other issue with Date column. As shown below…
Date
12/04/2022
04/04/2022
16-04-2022
11/04/2022
when it comes to 3rd rowit is throwing an error
Assign: String was not recognized as a valid DateTime.
Can u please help me to get out of this issue…
Thanks in Advance.
Hi,
The following will work. Can you try this?
DateTime.ParseExact(row("Date").ToString,{"d/M/yyyy","d/M/yyyy hh:mm:ss","d-M-yyyy"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("dd/MM/yyyy")
Regards,
Thanks a lot… @Yoichi
It is working fine.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.