I have a string “27 Nov” which i need to convert into date time format “MM/dd/yyyy” but i am getting error as “string not regonized as valid datetime”
DateTime.ParseExact(strVal,“dd MMM”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”)
ppr
(Peter Preuss)
2
prototyping within the immediate panel was working:
can you debug and inspect the value of strVal?
Actually i am getting date from get text and storing in datatable and using dt.rows(0)(“StorageDate”).tostring.trim in datetime.parseexact
Srini84
(Srinivas Kadamati)
4
@harshit.gupta
Check below link for your reference
Reference
Hope this may help you
Thanks
ppr
(Peter Preuss)
5
1 Like
Yoichi
(Yoichi)
6
Hi,
There might be different type whitespace in the string. So, for now, can you try the following expression?
DateTime.ParseExact(System.Text.RegularExpressions.Regex.Replace(dt.rows(0)("StorageDate").ToString,"\s",""),"dMMM",System.Globalization.CultureInfo.InvariantCulture).ToString("MM/dd/yyyy")
Regards,
Thankyou, this actually worked for me.
1 Like
system
(system)
Closed
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.