Im unable to use the function parseexact to transform the following String to Date
This one works:
Dim fechaS = "Feb 16 23:13:53.241 2015"
fecha1 = DateTime.ParseExact(fechaS, "MMM dd HH:mm:ss.fff yyyy", Nothing)
But fails, when I add a couple more options:
Dim fechaS = "Mon 16 23:13:53.241 UTC 2015"
fecha1 = DateTime.ParseExact(fechaS, "ddd MMM dd HH:mm:ss.fff z yyyy", Nothing)
Your second example has three issues with it:
z
signifies) . You could to this by replacing UTC
with +0
This fails
Dim fechaS = "Mon 16 23:13:53.241 UTC 2015"
fecha1 = DateTime.ParseExact(fechaS, "ddd MMM dd HH:mm:ss.fff z yyyy", Nothing)
This works
Dim fechaS = "Mon Feb 16 23:13:53.241 UTC 2015"
fecha1 = DateTime.ParseExact(fechaS.Replace("UTC", "+0"), "ddd MMM dd HH:mm:ss.fff z yyyy", Nothing)
More info here on the date time formats allowed: Custom DateTime Format Strings
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.