I know how to convert the date but i am not able to do it in UI Path. I am reading the date from Excel as row(“Date”) and i am trying to type the date using type in to activity like this : “01/01/17”. when converting i am getting error Invalid cast to double.
I am using generic type dtDate value to hold this conversion : convert.todatetime(row(date)) . Please help
As per assumption convert.todatetime(string) takes string as an argument. and just cross varify the datatype you are getting from datatable or excel whatever source.
otherwise you can use convert.todatetime(row(date).tostring()).
or if i assumed it wrong then please explain with more description or screenshot kind of
Regards…!!
Aksh
Here are the complete details , I am doing some minor mistake pls correct me :
Excel Source column : Date . Data type : Date
As i mentioned generic value to hold the data that is : dtDate.
i)now i am assigning dtdate = convert.todatetiime(row(date))
above line throws : Exception Found : Invalid cast from double to datetime
iI)now i am assigning dtdate = convert.todatetiime(row(date).Tostring)
above line throws : Exception Found : string was not recognized as valid datetime.
Instead rowdate if i use string value that is 11/11/17 then i can able to get the result. row(date) is causing the problem here any hint to solve this issue.
Row(Date) - Comes from My excel. Excel contains date column . I am just retrieving and converting it as you mentioned as below : dtdate as generic value :
Option 1 results following error : strict on disallow implicit converssion from string to integer
Option 2 results : strict on disallow implicit converssion from string to double.
here my main problem is row(date) which is nothing but xl date. Do i need to do any format or at Excel level please suggest.
when using above syntax I am getting following error. I believe my row(“Date”) format is causing the issue.I tried multiple options , can you please provide simple sample which reads date from Excel .
Sorry from office machine can not upload anything. But here is my format: Column named “Date” and I have formatted that cell category as Date and Type as “03/14/17” (“MM/DD/YY”).
You can extract any column consisting dates. Input that as DataTable, iterate to see if the date extracted is valid or in a serial format. Serial formats are converted via method invoked in the attached XAML. Give it a read, you will understand the flow fairly and easily. Hope it helps