开发者

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

开发者 https://www.devze.com 2023-03-27 15:49 出处:网络
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 j

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

0

精彩评论

暂无评论...
验证码 换一张
取 消