Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to turn a string to a DateTime object in .NET Micro?

I am 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

like image 935
Richard Avatar asked Oct 11 '22 07:10

Richard


1 Answers

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

like image 68
James Johnston Avatar answered Oct 12 '22 23:10

James Johnston