tags:

views:

48

answers:

1

Is there a way to determine the timezone of a DATE data type that has been converted to a SystemTime value?

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 
    }
}
A: 

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

Michael
Than you Michael but I need is COM equivalent. The DateTime object is is represented as a DATE type in the library. Since code I'm writing if for a Win32 COM library and not .net, using the kind property is out. I need to determine SYSTEMTIME timezone being set.
Reggie McCray