Both “Click before typing” and “Empty field before typing” are enabled. I suspect the issue might be resolved by changing the format of the result of the “CurrentRow.Item(2).ToString”, but I am unable to change the format without incurring errors.
I added the code you provided into the “Type into activity”. Unfortunately, when I run the program, it still inserts the values in the same format as before. It is as if the format is not getting updated as it should.
@Palaniyappan When I type the date into the field manually it works without any problems.
However, I have noticed that if I don’t click on the year, month and day separately when filling in the field, the year ends up taking on 6 digits, meaning it takes the values of the month as well.
I have also noticed that if I add two 0’s at the front of the date and 4 0’s at the back, the automation runs fine.
I added a message box to output the result of “CurrentRow.Item(1).ToString”.
This is the result:
The odd thing is, the format is in dd/MM/yyyy hh:mm:ss and not yyyy/MM/dd.
When I try to output the result of: DateTime.ParseExact(CurrentRow.Item(1).ToString(), “yyyy/MM/dd hh:mm”, System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy hh:mm:ss”)
I get this error:
“Message Box: String ‘11/20/2016 00:00:00’ was not recognized as a valid DateTime.”
I will tell you simple alternative, use Regex, to identify first 2 digits, then second set of 2 digits, and then last four digits (used forward slash essentially in Regex). Store it as month, date, year. And then create another variable fulldate (String), and three variable in it, in the pattern you want. This will resolve your issue, if you need more details on regex, etc let me know.