how to use DateTime.Parse() to create a DateTime object
Use DateTime.ParseExact
:
DateTime dateTime = DateTime.ParseExact("[Your Date Here]",
"yyyyMMddHHmmssfff",
CultureInfo.InvariantCulture);
Here's the MSDN Docs.
You would have to use
DateTime time = DateTime.ParseExact(String,String, IFormatProvider);
The first argument string is going to be your date. The second argument string is going to be your format The third argument is your culture info (which is the IFormatProvider
So you would have
DateTime TimeStamp = DateTime.ParseExact(Data[1],"yyyyMMddHHmmssfff",CultureInfo.InvariantCulture);
The culture info is "A CultureInfo object that represents the culture used to interpret s. The DateTimeFormatInfo object returned by its DateTimeFormat property defines the symbols and formatting in s." From MSDN.
here's the link for more info. http://msdn.microsoft.com/en-us/library/kc8s65zs.aspx
var sDate = "20110815174346225";
var oDate = DateTime.ParseExact(sDate, "yyyyMMddHHmmssfff", CultureInfo.CurrentCulture);