Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dayling Saving Time and GMT offset
Message
 
 
À
29/03/2012 03:41:58
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01539622
Message ID:
01539652
Vues:
34
>>>I have this method to detect if the server running the application is within a Dayling Saving Time period or not:
>>>
>>>
>>>        ' Return if we are during summer time or not
>>>        Public Function IsDaylightSavingTime() As Boolean
>>>            Dim ldDateServer As DateTime = DateTime.Now
>>>            Dim llDaylightSaveTime As Boolean = ldDateServer.IsDaylightSavingTime()
>>>
>>>            Return llDaylightSaveTime
>>>        End Function
>>>
>>>
>>>Then, I can use this result to establish a proper one hour offset to show the datetime in the proper format for the user.
>>>
>>>Javascript has a Date.getTimezoneOffset() function which returns the number of offset minutes from GMT. And, that is dynamic as per DST. So, I was wondering, instead of using the above .NET method to detect if we are or not within a DST period, which is then used to adjust the datetime for calculation, would there be a similar way as the javascript function to simply get the number of offset minutes from GMT as is from .NET? That would simplify some logics I have.
Dim result As Double = (DateTime.Now - DateTime.UtcNow).TotalMinutes
(assuming you are not worried about the elapsed ticks between retrieving the two values :-} )

I like a developer who thinks of everything ;-)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform