I think your first value 18098 is stored as a double value and that might be in this format ddMMyyyy
So better check it once by converting that to text in excel.
Regards,
Mahesh
I think your first value 18098 is stored as a double value and that might be in this format ddMMyyyy
So better check it once by converting that to text in excel.
Regards,
Mahesh
Hi Mahesh,
My first value i think its text only i have attached the excel. Please take a look into it.
@aamir, for this type you can convert using
DateTime.FromOADate(Convert.ToDouble(row(“ColumnName”).ToString)
Hi Dominic,
where i need to convert in my code can i share my code with you?
while assigning value to row(“Date”) give your expression.Tostring(“dd/MM/yyyy”)
Even for str_PrevDate first convert the value to datetime and then assign the value as string like .Tostring(“dd/MM/yyyy”)
Regards,
Mahesh
Hi Mahesh,
I didnt get exactly where i need to change i have changed at certain places but ia m not getting the desired result.
Inside foreach row,
1.If the string is not empty you are assigning that to strPre_date. so convert the row(Date) to datetime and then to .Tostring(“dd/MM/yyyy”)
2.One more in if the string contains("") there give.ToString(“dd/MM/yyyy”
Regards,
Mahesh
Hi Mahesh,
Getting an error convert.ToString(convert.ToDateTime(row(“Date”)))
Assign : Invalid cast from ‘Double’ to ‘DateTime’.
Hi arivi,
Any update on this?
sorry arivu
ok Do like this if the string is empty
before checking whether the string is containing(“/”) convert that to datetime and .Tostring(“dd/MM/yyyy”)
Regards,
Mahesh
Hi Mahesh,
apart from this in the frst row i am getting the value 19-07-1949
instead of 18098.
Hi Mahesh,
I have converted it like this convert.ToDateTime(str_PrevDate).ToString(“dd/MM/yyyy”).Contains(“/”) but its throwing an error String was not recognized as a valid DateTime.
Hi @aamir ,
In IF Condition
str_PrevDate.Contains("/")
In else condition use
Assign activity
row("Date")=DateTime.FromOADate(Convert.ToDouble(str_PrevDate))
Regards,
Arivu
Hi Arivu,
the code returns the following data again
19-07-1949
04-03-2017
03-04-2017
03-04-2017
03-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-05-2017
05-04-2017
05-04-2017
04-06-2017
yes you asked like that only right??