To populate my database I have been using the builtin SQLite command for datetime:
INSERT INTO samples (timestamp, sample_value) Values(datetime('now','localtime'), ...)
When I look at this on my Mac using a SQLite Reader called Base I see the following timestring:
2011-06-20 13:18:14
When I debug my vb.net program this line:
ts2 = CStr(r("timestamp"))
gives me
6/20/2011 1:18:14 PM
To parse this I have been using:
ts = DateTime.ParseExact(ts2, "M/d/yyyy H:mm:ss tt", _
System.Globalization.CultureInfo.CurrentUICulture)
This works for readings at 12:00:00 PM, but once I get to 1 PM I get a System.FormatException: String was not recognized as a valid DateTime.
Is this a UI formatting difference between PC and Mac? What might be going on?
I think you want
hopposed toHin your format string. Try"M/d/yyyy h:mm:ss tt"his is 12 hour format whileHis used in 24 hour format and your string6/20/2011 1:18:14 PMrequiresh.Reference