OVH Cloud OVH Cloud

Conversion heure TU en heure légale

1 réponse
Avatar
Emmanuel CHONION
Je dois convertir un heure (j'ai la date) TU (temps universel) en heure
normale, cad ajouter 1 h en heure d'hiver et 2h en heure d'été.

Comment trouver la date du changement par calcul ?

1 réponse

Avatar
Adam Pietrasiewicz
<<< Attention - mon adresse dans l'entete de ce message >>>
<<< est une adresse ANTISPAM - pour m'ecrire cliquez sur >>>
<<< http://www.cerbermail.com/?DQr0g2Y88R >>>
=================================================== Le 18 listopada 2003 14:53:45 Emmanuel CHONION a ecrit dans un message
news:bpd87h$7to$



Je dois convertir un heure (j'ai la date) TU (temps universel) en heure
normale, cad ajouter 1 h en heure d'hiver et 2h en heure d'été.

Comment trouver la date du changement par calcul ?



Ce qu'il y a au dessous te donne le nombre d'heures en format +0010 (comme
dans les entetes de mail)


Private Declare Function GetTimeZoneInformation Lib "kernel32" _
(lpTimeZoneInformation As TIME_ZONE_INFORMATION) As Long
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type

Private Type TIME_ZONE_INFORMATION
Bias As Long
StandardName(0 To 63) As Byte 'unicode (0-based)
StandardDate As SYSTEMTIME
StandardBias As Long
DaylightName(0 To 63) As Byte 'unicode (0-based)
DaylightDate As SYSTEMTIME
DaylightBias As Long
End Type
Private Const TIME_ZONE_ID_UNKNOWN As Long = 1
Private Const TIME_ZONE_ID_STANDARD As Long = 1
Private Const TIME_ZONE_ID_DAYLIGHT As Long = 2
Private Const TIME_ZONE_ID_INVALID As Long = &HFFFFFFFF


Function Heures() As String
On Error Resume Next
Heures = 0
Dim tzi As TIME_ZONE_INFORMATION
Dim dwBias As Long
Dim tmp As String

Select Case GetTimeZoneInformation(tzi)
Case TIME_ZONE_ID_DAYLIGHT:
dwBias = tzi.Bias + tzi.DaylightBias
Case Else: dwBias = tzi.Bias + tzi.StandardBias
End Select

tmp = Format((-1 * CStr(dwBias 60)) * 100, " +0000") '& " hours, " &
CStr(dwBias Mod 60) & " minutes"
If (-1 * CStr(dwBias 60)) * 100 < 0 Then
tmp = Replace(tmp, "+", "-")
End If
Heures = tmp

End Function



--
Adam Pietrasiewicz
Pologne
---
Ce message vous a ete apporte par Le Pigeon
http://www.amsoft.com.pl/golabek