I am getting error While converting the string variable to date format for following methods, please suggest me where i made mistake.
- Convert.ToDateTime Method
Eg:- Convert.ToDateTime(DobStr.ToString)
- DateTime.Parse method
Eg:- DateTime.Parse(DobStr.ToString)
I am able to achieve by using the following expression
DateTime.ParseExact(DobStr,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture)
Hey!
Try like this:
Assign strDate = Datetime.ParseExact(Strinput.ToString, “MM-dd-yyyy”, System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)
NOTE:
Where MM-dd-yyyy is the input format
Where dd/MM/yyyy is the output format
Regards,
NaNi
postwick
(Paul Ostwick)
4
If a variable’s datatype is string, you don’t need to put .ToString on the end of it
ppr
(Peter Preuss)
5
ppr
(Peter Preuss)
7
this string is parseable with the mentioned option

ensure that dd/MM/yyyy format pattern is always matching the format pattern of your string
Convert.toDateTime, DateTime.Parse, CDate will not handle the dd/MM/yyyy format
So, is your topic solved or what is your further open question on this?
2 Likes
system
(system)
Closed
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.