January 12, 2021, 3:57am
I have trouble but do not know anyway to resolve. I have tried to find all of thread but still same.
The excel file has a column with Date format ( dd/MM/yyyy)… but it has problem when i read it to convert the format which i want.
I have tried to convert into many way such as :
Datetime.ParseExact(row(“Ngày giao dịch”).ToString,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)
Before convert it into format i want, i have read it first and it show result as below picture. But it still error after i convert.
How to resolved this issue?
Thanks in advance!
January 12, 2021, 4:04am
Use this below code
Datetime.ParseExact(“20/11/2020”,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture).GetType put this in message box and check the type.
January 12, 2021, 4:27am
It still show the error : “Message Box: String was not recognized as a valid DateTime.”
January 12, 2021, 4:36am
Can you trim the variable : Out_NgayGiaoDich_New.ToString.Trim and check
Beacuase Im not getting any error in my machine Or it can be due to whitespace present in the Out_NgayGiaoDich_New value.
January 12, 2021, 4:45am
Thanks you very much.
I think the command : Mydate.ToString.trim is correct before convert into new format
January 15, 2021, 4:48am
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.