How to turn a string to a DateTime object in .NET Micro?
I 开发者_StackOverflowam wondering if there is an easy way to turn a string like: 110811124209.197
into a datetime object where the format is yymmddhhmmss.sss
. If was were using regular .net I would just use
DateTime.ParseExact(MyDateString, "yyMMddHHmmtt.ttt");
but it would seem that ParseExact is not apart DateTime in .net micro
Split the string apart manually and use this constructor: http://msdn.microsoft.com/en-us/library/wb249tb7.aspx
public DateTime(
int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond
)
You can use String.Substring to split it apart: http://msdn.microsoft.com/en-us/library/aka44szs.aspx
精彩评论