开发者

How to determin if a SystemTime value is in UTC

Is there a way to determine the timezone of a DATE data type that has been converted to a SystemTime val开发者_StackOverflowue?

Let say a C# file using the COM lib set the value below:

someComInterface.someDateAttribute = new DateTime(somedate).ToUniversalTime();

In the COM library I want to do something like this

if(VariantTimeToSystemTime(DATE, &systm )){   
    if(st == UTC ){ 
          //do something 
    }
    else{ 
          // do something with localtime 
    }
}


According to MSDN: http://msdn.microsoft.com/en-us/library/system.datetime.kind.aspx

The DateTime kind property "gets a value that indicates whether the time represented by this instance is based on local time, Coordinated Universal Time (UTC), or neither."

If it's local, you'll want to check the TimeOffset property.

http://msdn.microsoft.com/en-us/library/system.datetimeoffset.aspx

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜