Hi all,
I am stuck at a point.Please help me
I have a text file, I am converting it to Excel.
I have a column by name TrDate with 1000 rows till last year 31st the date was come as dd-MM-yyyy and BOT was running as expected.
But from yesterday the date is coming as d/M/yyyy but BOT is reading it as 1st February 2024.
I want the BOT to read it as 2nd January 2024.
After reading I need to filter the date with present date.
Hi @Pavan_Kumar177 I am downloading file from an application.
It comes in .txt format and I am converting text to Excel and getting the output as above picture
Dim dt As DataTable = dt_Input
For Each row As DataRow In dt.Rows
Dim dateString As String = row("Dates").ToString()
' Check if the date format is "d/M/yyyy"
If DateTime.TryParseExact(dateString, "d/M/yyyy hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, Nothing) Then
Dim originalDate As DateTime = DateTime.ParseExact(dateString, "d/M/yyyy hh:mm:ss", CultureInfo.InvariantCulture)
row("Dates") = originalDate.ToString("dd-MM-yyyy")
End If
Next
@lrtetala Thanks a lot for your help but in my system after doing the Invoke code still it is writing as 2/1/2024 and BOT is reading as 1st February 2024
Hello @0bb4628e217fd43ac86ac9294
It seems like the input date format was changed to MM/dd/yyyy from dd/MM/yyyy and your robot is handle like FEB 1.
So you need to swap it to the format that you expected like @lrtetala showed you above, but in this way (changing the input date format):
If DateTime.TryParseExact(dateString, "M/d/yyyy hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, Nothing) Then
Dim originalDate As DateTime = DateTime.ParseExact(dateString, "M/d/yyyy hh:mm:ss", CultureInfo.InvariantCulture)
row("Dates") = originalDate.ToString("dd-MM-yyyy")
End If
Note: Other way is probably using the new activity to format the date to text on v23.10 within a loop.