I can't seem to be able to convert a string that contains date value of "100714 0700" (2010-07-14 7am) to a date format in vb.net 2005
When I attempt to do:
Dim provider As Globalization.CultureInfo = Globalization.CultureInfo.InvariantCulture
strPickupDateTime = DateTime.ParseExact(txtPickupDate.Text, "yym开发者_如何学Cmdd", provider)
I get back "1/14/2010 12:07:00 AM"
How can I get a value of "2010-07-14 7:00" ?Here is another link from here on SO that shows how to do this in C#
Convert String to Date in .NET if my incoming date format is in YYYYMMDD
In your case you probably also want add the time format:
string s = "100714 0700";
DateTime d = DateTime.ParseExact(s, "yyMMdd hhmm", CultureInfo.InvariantCulture);
Sorry, I read the question to quickly last time, hmmm have you tried something like strPickupDateTime = DateTime.ParseExact(txtPickupDate.Text, "yy" & "-" & "-" & "mm" & "-" & "dd", provider)
精彩评论