Hi,
I am trying to convert a string array variable to a date time array variable, but cannot seem to work.
Thanks in advance!
Hi,
I am trying to convert a string array variable to a date time array variable, but cannot seem to work.
Thanks in advance!
Hi @AshwinS2
That solution is converting the date format in string array. I am looking for converting string array to date time array. Or is there a way where i can extract datatable as date time format?
dd/MM/yyy
Thanks!
Fine
can i have a example like
once after getting the datatble of this excel with read range activity and use a FOR EACH ROW activity and pass the datatable variable as input
–inside the loop use a writeline activity and mention like this
row(0).ToString
so that we could know the dateformat that excel gives us
kindly share that screenshot from output panel if possible
based on which we can easily convert that to a array of datetime
@kieranwong
Sure here is the output
Create an Empty List of Datetime Format and for each Item in the String List Use an Assign and convert that to datetime Convert.ToDateTime(item.ToString) and add it to the datetime list
Sorry but what to do mean by create an Empty list of Datetime format. How do I do it ?
Fantastic
hope these steps would help you resolve this
–once after getting the datatable from read range activity use a assign activity like this
datetimearrayvariable = datatablename.AsEnumerable().Select(Function(a) Datetime.ParseExact(a.Field(of string)(“Holidays”).ToString.Substring(0,10),“MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture)).ToArray()
–where datetimearrayvariable is a array of Datetime variable
Cheers @kieranwong
Its an Array of type DateTime
user timeout
The whole RPA script does not even start
Hello Kieran,
Be careful regarding assuming the datatype within Excel. While Excel will present the data in a given way that may make you believe that it is a string, what UiPath actually gets back can be wildly different, especially with Timestamps.
In this case, what you’re seeing could be a Double instead. The reason I believe this is because actual string values are left aligned and the picture of your spreadsheet shows that the Day and Name are but the Holidays column is not.
I would suggest looking at DateTime.FromOADate
if my suspicions are correct.