La date ne conserve pas les heures en zero 00:00:00

siocnarf

XLDnaute Occasionnel
Bonjour,

J'ai un champs date qui se présente ainsi: "20110620040000.000000-000"
Après avoir convertis le champs j'arrive à 2011-06-20 04:00:00

Maintenant pour obtenir l'heure locale:
Code:
DateAdd("h", -4, UTCToDate(objEvent.TimeWritten))
et le résultat est 2011-06-20 au lieu de 2011-06-20 00:00:00.

Voici la fonction UTCtoDate:
Code:
Function DateToUTC(dtmTargetDate, Q_strBias)

dtmtestdate = dtmTargetDate
'WScript.Echo dtmtestdate

dtmTargetDate = Year(dtmTargetDate)
'Wscript.Echo dtmTargetDate

dtmMonth = Month(dtmtestdate)
'WScript.Echo dtmMonth

If Len(dtmMonth) = 1 Then
    dtmMonth = "0" & dtmMonth
End If

dtmTargetDate = dtmTargetDate & dtmMonth
'Wscript.Echo dtmTargetDate

dtmDay = Day(dtmtestdate)
If Len(dtmDay) = 1 Then
    dtmDay = "0" & dtmDay
End If

dtmTargetDate = dtmTargetDate & dtmDay & "000000.000000"
dtmTargetDate = dtmTargetDate & CStr(Q_strBias)

' MsgBox(dtmtestdate & " " & dtmTargetDate)
DateToUTC = dtmTargetDate

End Function
Comment pourrais-je obtenir qu'il conserve les 0 à la fin?


Merci,

François
 
Dernière édition:

Discussions similaires