Hi all,
The cell I am trying to read is “27.07.18” - i keep getting the same error, unless I change the format to “07.27.18”
What should i do?
Hi all,
The cell I am trying to read is “27.07.18” - i keep getting the same error, unless I change the format to “07.27.18”
What should i do?
For full control use datetime.parseexact
First try to read this as a string, next parse this as datetime format - datetime.parseexact(…)
IF you still receive error try to replace 18 with 2018 and try again
you can use .trim in the string
or
you can use there
.Tostring
Get your date from the excel as string and convert it as date in assign activity as below
Assign to a date variable: Convert.ToDateTime(dt.Rows(0)(“YourDate”).ToString).Date
Then while feeding it in your website convert your date as below
DateTime.ParseExact(convertedDate.ToString(“MM.dd.yyyy”), “MM.dd.yyyy”, Nothing).ToString(“dd-MM-yyyy”)
When I try to convert a string to a date time I get an error message “String was not recognized as a valid DateTime”. However this only happens when I get the data from a website using Get Text, if I populate the variable directly by typing in the exact same string into an AB Assign there is no issue when trying to convert.
The variable is 28/11/2018 and I am using DateTime.ParseExact(Variable.ToString(),“dd/MM/yyyy”,Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”)
Hey @Shaun_Manuel , may be there are some spaces when you are getting data from web trim that string by adding .trim in its end and try once
Does uipath only allow one datetime format like day/month/year cos when i try to change the format to start with the year, " i get Message Box: String was not recognized as a valid DateTime."
Hello I am having the same problem even after I tried upper solutions.
Please instantiate your datetime variable in variable default panel and try.
Like below:
Variable Name: datecurrentperson
Default Value: new DateTime()
Hello Avene,
In this video I do a lot of stuff with String and DateTime:
0:35 Examples for Substring functions
4:10 IndexOf and LastIndexOf
5:00 SubString working together IndexOf and LastIndexOf
6:45 Split string by character
8:50 Split string by string
12:00 Lower Case and Upper Case
12:45 Trim
15:05 Compare strings in multiple ways
19:05 Resume of all the String function part
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
DateTime.ParseExact(attachment.Headers(“Date”).ToString(),“MM dd yyyy HH:mm:ss”,system.Globalization.CultureInfo.InvariantCulture).ToString(“MMddyyyy_HHmmss”)
I want to name folder using the receive date in the email. I had the same error what should I do ?thank you!!
try to print attachment.Headers(“Date”).ToString and see what output you get in msg box whether it contains any extra spaces and all. If yes then trim those spaces.
Hey
Were you able to find a resolution for your query, as I am also facing the same error.