Mr.H
January 8, 2021, 2:51pm
1
Hi Everyone.
I have cell with date format ( dd/MM/yyyy ) : 20/11/2020
But i have received an error as title when read it. I have tried some ways as below
DateTime: Date_Text = Convert.ToDateTime(row(“Date Column”).ToString)
DateTime: Date_Text = Datetime.ParseExact(row(“Date Column”).ToString,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture)
How to do resolve this issue?
Thanks in advance!
@Mr.H - Could you please print the output of Date_Text after the first statement to see what is the format it is printing?
1 Like
Mr.H
January 8, 2021, 3:10pm
3
Hi Bro.
I have print it before convert and received : 20/11/2020
@Mr.H - Please try like below : dd/MM/yyyy HH:mm:ss
See example below: My Input
Code:
DateTime.ParseExact(row(“Receiption Date”).ToString,“MM/dd/yyyy HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture).Tostring(“dd-MM-yyyy”)
Output
2 Likes
Mr.H
January 8, 2021, 5:06pm
5
Thanks you bro.
But my date format is different to your sample.
I will try to find another way with VBA.
@Mr.H - Please look closely…My format and your format are same(yours is dd/MM mine is MM/dd)…I am asking you to try adding HH:mm:ss at the end … dd/MM/yyyy HH:mm:ss…
If you see my input i dont have HH:mm:ss value, but after adding that value it worked…
Why can’t you give it a try?
1 Like
Mr.H
January 9, 2021, 1:40pm
7
Thanks you Bro.
I have tried your way combine and found the solution for my case.
system
(system)
Closed
January 12, 2021, 1:40pm
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.