datetime question

  • Thread starter Thread starter David Bartosik - MS MVP
  • Start date Start date
D

David Bartosik - MS MVP

VB script has a "getTimezoneOffset" for "Date". I'm not finding this for
..net's "DateTime". Looking for advice on the use of datetime for this and/or
referral to some documentation.
 
Hi,

I am not a JavaScript guy, so based on what the help says about
getTimeZoneOffest,
I believe the GetUtcOffset method of the TimeZone class is what you are
looking for.

Hope this helps

Chris Taylor
 
Hi David ,


Thank you for the response. Based on your description, you are looking for
a method to get the UTC offset using the dotnet's DateTime class which is
similiar to the "getTimezoneOffset" in VBSCript or JScript. Is my
understanding right?

I've reviewed some reference in the MSDN, in the .NET Framework, there is
no direct equivalent method to get the UTC offset.
You can subtract the System.DateTime.UtcNow property from the DateTime.Now
property and get the TimeSpan object which
express the UTCoffset, just as:

System.TimeSpan offTS = System.DateTime.Now - System.DateTime.UtcNow;
Response.Write("<br>" + offTS.TotalMinutes.ToString());

For more information on the dotnet framework's DateTime structure, you can
visit the following link to MSDN:
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDateTimeClassT
opic.asp?frame=true

If you have any question on it, please feel free to let me know.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Hi Steven,

If you see my reply to David's post, you will see there is a TimeZone class,
this class has a method called GetUtcOffset that I believe yields the
desired results.

Regards

Chris Taylor
 
Back
Top