Mr.H
January 12, 2021, 3:57am
1
Hi Everyone.
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 :
Convert.ToDateTime(row(“Date”).ToString)
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!
Manish540
(Manish Shettigar)
January 12, 2021, 4:04am
2
Use this below code @Mr.H
Datetime.ParseExact(“20/11/2020”,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture).GetType put this in message box and check the type.
2 Likes
Mr.H
January 12, 2021, 4:27am
3
Hi Bro.
It still show the error : “Message Box: String was not recognized as a valid DateTime.”
Manish540
(Manish Shettigar)
January 12, 2021, 4:36am
4
Can you trim the variable : Out_NgayGiaoDich_New.ToString.Trim and check @Mr.H ?
Beacuase Im not getting any error in my machine Or it can be due to whitespace present in the Out_NgayGiaoDich_New value.
2 Likes
Mr.H
January 12, 2021, 4:45am
5
Hi Bro.
Thanks you very much.
I think the command : Mydate.ToString.trim is correct before convert into new format
system
(system)
Closed
January 15, 2021, 4:48am
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.