@Kiffi: Ja, das ist auch eine Möglichkeit. Wenn die Größe der Programmdatei keine Rolle spielt oder die Datenbank-Funktionen bereits im Programm verwendet werden, kann man natürlich auch zu dieser Lösung greifen.
Habe ich nicht gemerkt, dass du den Code in deinem erstem Beitrag ausgetauscht hast. Mit der angepassten Struktur erhalte ich nun korrekte Werte; zuvor war es glaube ich immer Null. Super!
Das unschöne "#SecondsInOneHour" ist somit weg.
Im aktuellen Stand des Codes gibt es komischerweise manchmal im Monat "März" und einmal im April eine Abweichung von einer Stunde:
Code: Alles auswählen
DeclareModule Date64
Declare.i IsLeapYear(Year.i)
Declare.i DaysInMonth(Year.i, Month.i)
Declare.q Date64(Year.i = -1, Month.i = 1, Day.i = 1, Hour.i = 0, Minute.i = 0, Second.i = 0)
Declare.q LocalDateAsUTC64()
Declare.i Year64(Date.q)
Declare.i Month64(Date.q)
Declare.i Day64(Date.q)
Declare.i Hour64(Date.q)
Declare.i Minute64(Date.q)
Declare.i Second64(Date.q)
Declare.i DayOfWeek64(Date.q)
Declare.i DayOfYear64(Date.q)
Declare.q AddDate64(Date.q, Type.i, Value.i)
Declare.s FormatDate64(Mask.s, Date.q)
Declare.q ParseDate64(Mask.s, Date.s)
EndDeclareModule
Module Date64
CompilerIf #PB_Compiler_OS = #PB_OS_Linux Or #PB_Compiler_OS = #PB_OS_MacOS
ImportC ""
gmtime_r(time.i, result.i)
EndImport
CompilerEndIf
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS And #PB_Compiler_Processor = #PB_Processor_x86
CompilerError "32-Bit not supported on MacOS"
CompilerEndIf
EnableExplicit
; == Windows ==
; >> Minimum: 01.01. 1601 00:00:00
; >> Maximum: 31.12.30827 23:59:59
; == Linux ==
; 32-Bit:
; >> Minimum: 01.01.1902 00:00:00
; >> Maximum: 18.01.2038 23:59:59
; 64-Bit:
; >> Minimum: 01.01. 0000 00:00:00
; >> Maximum: 31.12.999999999 23:59:59
; == MacOS ==
; wie bei Linux?
#SecondsInOneHour = 60 * 60
#SecondsInOneDay = #SecondsInOneHour * 24
#HundredNanosecondsInOneSecond = 10000000
#HundredNanosecondsFrom_1Jan1601_To_1Jan1970 = 116444736000000000
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Linux
If Not Defined(tm, #PB_Structure)
Structure tm Align #PB_Structure_AlignC
tm_sec.l ; 0 bis 59 oder bis 60 bei Schaltsekunde
tm_min.l ; 0 bis 59
tm_hour.l ; 0 bis 23
tm_mday.l ; Tag des Monats: 1 bis 31
tm_mon.l ; Monat: 0 bis 11 (Monate seit Januar)
tm_year.l ; Anzahl der Jahre seit dem Jahr 1900
tm_wday.l ; Wochentag: 0 bis 6, 0 = Sonntag
tm_yday.l ; Tage seit Jahresanfang: 0 bis 365 (365 ist also 366, da nach 1. Januar gezählt wird)
tm_isdst.l ; Ist Sommerzeit? tm_isdst > 0 = Ja
; tm_isdst = 0 = Nein
; tm_isdst < 0 = Unbekannt
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
tm_gmtoff.l ; Offset von UTC in Sekunden
*tm_zone ; Abkürzungsname der Zeitzone
CompilerElse
tm_zone.l ; Abkürzungsname der Zeitzone
tm_gmtoff.l ; Offset von UTC in Sekunden
*tm_zone64 ; ??? Abkürzungsname der Zeitzone
CompilerEndIf
EndStructure
EndIf
CompilerCase #PB_OS_MacOS
If Not Defined(tm, #PB_Structure)
Structure tm Align #PB_Structure_AlignC
tm_sec.l ; 0 bis 59 oder bis 60 bei Schaltsekunde
tm_min.l ; 0 bis 59
tm_hour.l ; 0 bis 23
tm_mday.l ; Tag des Monats: 1 bis 31
tm_mon.l ; Monat: 0 bis 11 (Monate seit Januar)
tm_year.l ; Anzahl der Jahre seit dem Jahr 1900
tm_wday.l ; Wochentag: 0 bis 6, 0 = Sonntag
tm_yday.l ; Tage seit Jahresanfang: 0 bis 365 (365 ist also 366, da nach 1. Januar gezählt wird)
tm_isdst.l ; Ist Sommerzeit? tm_isdst > 0 = Ja
; tm_isdst = 0 = Nein
; tm_isdst < 0 = Unbekannt
tm_zone.l ; Abkürzungsname der Zeitzone (Auch bei 64bit ein 32bit Wert)
tm_gmtoff.l ; Offset von UTC in Sekunden
*tm_zone64 ; ??? Abkürzungsname der Zeitzone
EndStructure
EndIf
CompilerEndSelect
Procedure.i IsLeapYear(Year.i)
If Year < 1600
; vor dem Jahr 1600 sind alle Jahre Schaltjahre, die durch 4 restlos teilbar sind
ProcedureReturn Bool(Year % 4 = 0)
Else
; ab dem Jahr 1600 sind alle Jahre Schaltjahre, die folgende Bedingungen erfüllen:
; => restlos durch 4 teilbar, jedoch nicht restlos durch 100 teilbar
; => restlos durch 400 teilbar
ProcedureReturn Bool((Year % 4 = 0 And Year % 100 <> 0) Or Year % 400 = 0)
EndIf
EndProcedure
Procedure.i DaysInMonth(Year.i, Month.i)
While Month > 12
Year + 1
Month - 12
Wend
While Month < 0
Year - 1
Month + 13
Wend
If Month = 0
Month = 1
EndIf
Select Month
Case 1, 3, 5, 7, 8, 10, 12: ProcedureReturn 31
Case 4, 6, 9, 11: ProcedureReturn 30
Case 2: ProcedureReturn 28 + IsLeapYear(Year) ; Februar hat im Schaltjahr ein Tag mehr
EndSelect
EndProcedure
Procedure.q Date64(Year.i = -1, Month.i = 1, Day.i = 1, Hour.i = 0, Minute.i = 0, Second.i = 0)
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
Protected.SYSTEMTIME st
Protected.FILETIME ft
Protected.i DaysInMonth
If Year > -1 ; Gültiges Datum
; Angaben evtl. korrigieren
Minute + Second/60
Second % 60
If Second < 0
Minute - 1
Second + 60
EndIf
Hour + Minute/60
Minute % 60
If Minute < 0
Hour - 1
Minute + 60
EndIf
Day + Hour/24
Hour % 24
If Hour < 0
Day - 1
Hour + 24
EndIf
While Month > 12
Year + 1
Month - 12
Wend
If Month = 0
Month = 1
EndIf
DaysInMonth = DaysInMonth(Year, Month)
While Day > DaysInMonth
Day - DaysInMonth
Month + 1
If Month > 12
Year + 1
Month - 12
EndIf
DaysInMonth = DaysInMonth(Year, Month)
Wend
If Day < 0
Month - 1
If Month = 0
Year - 1
Month = 12
EndIf
Day + DaysInMonth(Year, Month)
EndIf
st\wYear = Year
st\wMonth = Month
st\wDay = Day
st\wHour = Hour
st\wMinute = Minute
st\wSecond = Second
SystemTimeToFileTime_(@st, @ft)
; Zeit in Sekunden umrechnen
ProcedureReturn (PeekQ(@ft) - #HundredNanosecondsFrom_1Jan1601_To_1Jan1970) / #HundredNanosecondsInOneSecond
Else ; Kein gültiges Datum. Systemzeit wird ermittelt
GetLocalTime_(@st)
SystemTimeToFileTime_(@st, @ft)
; Zeit in Sekunden umrechnen
ProcedureReturn (PeekQ(@ft) - #HundredNanosecondsFrom_1Jan1601_To_1Jan1970) / #HundredNanosecondsInOneSecond
EndIf
CompilerElse ; Linux oder Mac
Protected.tm tm
Protected.q time
Protected.tm *Memory_localtime
If Year > -1 ; Gültiges Datum
tm\tm_year = Year - 1900 ; Jahre ab 1900
tm\tm_mon = Month - 1 ; Monate ab Januar
tm\tm_mday = Day
tm\tm_hour = Hour
tm\tm_min = Minute
tm\tm_sec = Second
tm\tm_isdst = -1 ; <<<<<< ist wichtig, sonst sind viele Werte falsch, die mktime() zurückgibt
; mktime korrigiert die Angaben selber und liefert bereits Sekunden
time = mktime_(@tm)
time + tm\tm_gmtoff
ProcedureReturn time
Else ; Kein gültiges Datum. Systemzeit wird ermittelt
time = time_(0)
If time > -1
*Memory_localtime = AllocateMemory(SizeOf(tm))
If *Memory_localtime
localtime_r_(@time, *Memory_localtime) ; Per Memory ist es thread-sicher
time = mktime_(*Memory_localtime)
time + *Memory_localtime\tm_gmtoff
FreeMemory(*Memory_localtime)
If time > -1
ProcedureReturn time
EndIf
EndIf
EndIf
EndIf
CompilerEndIf
EndProcedure
Procedure.q LocalDateAsUTC64()
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
Protected.SYSTEMTIME st
Protected.FILETIME ft
GetSystemTime_(@st)
SystemTimeToFileTime_(@st, @ft)
; Zeit in Sekunden umrechnen
ProcedureReturn (PeekQ(@ft) - #HundredNanosecondsFrom_1Jan1601_To_1Jan1970) / #HundredNanosecondsInOneSecond
CompilerElse ; Linux oder Mac
ProcedureReturn time_(0)
CompilerEndIf
EndProcedure
Procedure.i Year64(Date.q)
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
Protected.SYSTEMTIME st
Date = Date * #HundredNanosecondsInOneSecond + #HundredNanosecondsFrom_1Jan1601_To_1Jan1970
FileTimeToSystemTime_(@Date, @st)
ProcedureReturn st\wYear
CompilerElse ; Linux oder Mac
Protected.tm *Memory_TimeStruc
Protected.i Year
*Memory_TimeStruc = AllocateMemory(SizeOf(tm))
If *Memory_TimeStruc
gmtime_r(@Date, *Memory_TimeStruc) ; Per Memory ist es thread-sicher
Year = *Memory_TimeStruc\tm_year
FreeMemory(*Memory_TimeStruc)
ProcedureReturn Year + 1900
Else
ProcedureReturn -1
EndIf
CompilerEndIf
EndProcedure
Procedure.i Month64(Date.q)
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
Protected.SYSTEMTIME st
Date = Date * #HundredNanosecondsInOneSecond + #HundredNanosecondsFrom_1Jan1601_To_1Jan1970
FileTimeToSystemTime_(@Date, @st)
ProcedureReturn st\wMonth
CompilerElse ; Linux oder Mac
Protected.tm *Memory_TimeStruc
Protected.i Month
*Memory_TimeStruc = AllocateMemory(SizeOf(tm))
If *Memory_TimeStruc
gmtime_r(@Date, *Memory_TimeStruc) ; Per Memory ist es thread-sicher
Month = *Memory_TimeStruc\tm_mon
FreeMemory(*Memory_TimeStruc)
ProcedureReturn Month + 1
Else
ProcedureReturn -1
EndIf
CompilerEndIf
EndProcedure
Procedure.i Day64(Date.q)
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
Protected.SYSTEMTIME st
Date = Date * #HundredNanosecondsInOneSecond + #HundredNanosecondsFrom_1Jan1601_To_1Jan1970
FileTimeToSystemTime_(@Date, @st)
ProcedureReturn st\wDay
CompilerElse ; Linux oder Mac
Protected.tm *Memory_TimeStruc
Protected.i Day
*Memory_TimeStruc = AllocateMemory(SizeOf(tm))
If *Memory_TimeStruc
gmtime_r(@Date, *Memory_TimeStruc) ; Per Memory ist es thread-sicher
Day = *Memory_TimeStruc\tm_mday
FreeMemory(*Memory_TimeStruc)
ProcedureReturn Day
Else
ProcedureReturn -1
EndIf
CompilerEndIf
EndProcedure
Procedure.i Hour64(Date.q)
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
Protected.SYSTEMTIME st
Date = Date * #HundredNanosecondsInOneSecond + #HundredNanosecondsFrom_1Jan1601_To_1Jan1970
FileTimeToSystemTime_(@Date, @st)
ProcedureReturn st\wHour
CompilerElse ; Linux oder Mac
Protected.tm *Memory_TimeStruc
Protected.i Hour
*Memory_TimeStruc = AllocateMemory(SizeOf(tm))
If *Memory_TimeStruc
gmtime_r(@Date, *Memory_TimeStruc) ; Per Memory ist es thread-sicher
Hour = *Memory_TimeStruc\tm_hour
FreeMemory(*Memory_TimeStruc)
ProcedureReturn Hour
Else
ProcedureReturn -1
EndIf
CompilerEndIf
EndProcedure
Procedure.i Minute64(Date.q)
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
Protected.SYSTEMTIME st
Date = Date * #HundredNanosecondsInOneSecond + #HundredNanosecondsFrom_1Jan1601_To_1Jan1970
FileTimeToSystemTime_(@Date, @st)
ProcedureReturn st\wMinute
CompilerElse ; Linux oder Mac
Protected.tm *Memory_TimeStruc
Protected.i Minute
*Memory_TimeStruc = AllocateMemory(SizeOf(tm))
If *Memory_TimeStruc
gmtime_r(@Date, *Memory_TimeStruc) ; Per Memory ist es thread-sicher
Minute = *Memory_TimeStruc\tm_min
FreeMemory(*Memory_TimeStruc)
ProcedureReturn Minute
Else
ProcedureReturn -1
EndIf
CompilerEndIf
EndProcedure
Procedure.i Second64(Date.q)
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
Protected.SYSTEMTIME st
Date = Date * #HundredNanosecondsInOneSecond + #HundredNanosecondsFrom_1Jan1601_To_1Jan1970
FileTimeToSystemTime_(@Date, @st)
ProcedureReturn st\wSecond
CompilerElse ; Linux oder Mac
Protected.tm *Memory_TimeStruc
Protected.i Second
*Memory_TimeStruc = AllocateMemory(SizeOf(tm))
If *Memory_TimeStruc
gmtime_r(@Date, *Memory_TimeStruc) ; Per Memory ist es thread-sicher
Second = *Memory_TimeStruc\tm_sec
FreeMemory(*Memory_TimeStruc)
ProcedureReturn Second
Else
ProcedureReturn -1
EndIf
CompilerEndIf
EndProcedure
Procedure.i DayOfWeek64(Date.q)
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
Protected.SYSTEMTIME st
Date = Date * #HundredNanosecondsInOneSecond + #HundredNanosecondsFrom_1Jan1601_To_1Jan1970
FileTimeToSystemTime_(@Date, @st)
ProcedureReturn st\wDayOfWeek
CompilerElse ; Linux oder Mac
Protected.tm *Memory_TimeStruc
Protected.i DayOfWeek
*Memory_TimeStruc = AllocateMemory(SizeOf(tm))
If *Memory_TimeStruc
gmtime_r(@Date, *Memory_TimeStruc) ; Per Memory ist es thread-sicher
DayOfWeek = *Memory_TimeStruc\tm_wday
FreeMemory(*Memory_TimeStruc)
ProcedureReturn DayOfWeek
Else
ProcedureReturn -1
EndIf
CompilerEndIf
EndProcedure
Procedure.i DayOfYear64(Date.q)
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
Protected.q TempDate
TempDate = Date64(Year64(Date))
ProcedureReturn (Date - TempDate) / #SecondsInOneDay + 1
CompilerElse ; Linux oder Mac
Protected.tm *Memory_TimeStruc
Protected.i DayOfYear
*Memory_TimeStruc = AllocateMemory(SizeOf(tm))
If *Memory_TimeStruc
gmtime_r(@Date, *Memory_TimeStruc) ; Per Memory ist es thread-sicher
DayOfYear = *Memory_TimeStruc\tm_yday
FreeMemory(*Memory_TimeStruc)
ProcedureReturn DayOfYear + 1
Else
ProcedureReturn -1
EndIf
CompilerEndIf
EndProcedure
Procedure.q AddDate64(Date.q, Type.i, Value.i)
Protected.i Day, Month, Year
Select Type
Case #PB_Date_Year: ProcedureReturn Date64(Year64(Date) + Value, Month64(Date), Day64(Date), Hour64(Date), Minute64(Date), Second64(Date))
Case #PB_Date_Month
Day = Day64(Date)
Month = Month64(Date) + Value
Year = Year64(Date)
If Day > DaysInMonth(Year, Month)
; mktime_() korrigiert das zwar auch, wendet dabei aber eine andere Methode als PB-AddDate() an:
; >> mktime_(): 31.03.2004 => 1 Monat später => 01.05.2004
; >> PB-AddDate(): 31.03.2004 => 1 Monat später => 30.04.2004
; setzte Tag auf das Maximum des neuen Monats
Day = DaysInMonth(Year, Month)
EndIf
ProcedureReturn Date64(Year64(Date), Month, Day, Hour64(Date), Minute64(Date), Second64(Date))
Case #PB_Date_Week: ProcedureReturn Date64(Year64(Date), Month64(Date), Day64(Date) + Value * 7, Hour64(Date), Minute64(Date), Second64(Date))
Case #PB_Date_Day: ProcedureReturn Date64(Year64(Date), Month64(Date), Day64(Date) + Value, Hour64(Date), Minute64(Date), Second64(Date))
Case #PB_Date_Hour: ProcedureReturn Date64(Year64(Date), Month64(Date), Day64(Date), Hour64(Date) + Value, Minute64(Date), Second64(Date))
Case #PB_Date_Minute: ProcedureReturn Date64(Year64(Date), Month64(Date), Day64(Date), Hour64(Date), Minute64(Date) + Value, Second64(Date))
Case #PB_Date_Second: ProcedureReturn Date64(Year64(Date), Month64(Date), Day64(Date), Hour64(Date), Minute64(Date), Second64(Date) + Value)
EndSelect
EndProcedure
Procedure.s FormatDate64(Mask.s, Date.q)
Protected.s Retval
Retval = ReplaceString(Mask, "%yyyy", RSet(Str(Year64(Date)), 4, "0"))
Retval = ReplaceString(Retval, "%yy", RSet(Right(Str(Year64(Date)), 2), 2, "0"))
Retval = ReplaceString(Retval, "%mm", RSet(Str(Month64(Date)), 2, "0"))
Retval = ReplaceString(Retval, "%dd", RSet(Str(Day64(Date)), 2, "0"))
Retval = ReplaceString(Retval, "%hh", RSet(Str(Hour64(Date)), 2, "0"))
Retval = ReplaceString(Retval, "%ii", RSet(Str(Minute64(Date)), 2, "0"))
Retval = ReplaceString(Retval, "%ss", RSet(Str(Second64(Date)), 2, "0"))
ProcedureReturn Retval
EndProcedure
Procedure.q ParseDate64(Mask.s, Date.s)
Protected.i i, DatePos = 1, IsVariableFound, Year, Month = 1, Day = 1, Hour, Minute, Second
Protected.s MaskChar, DateChar
For i = 1 To Len(Mask)
MaskChar = Mid(Mask, i, 1)
DateChar = Mid(Date, DatePos, 1)
If MaskChar <> DateChar
If MaskChar = "%" ; Vielleicht eine Variable?
If Mid(Mask, i, 5) = "%yyyy"
IsVariableFound = #True
Year = Val(Mid(Date, DatePos, 4))
DatePos + 4 ; Die 4 Nummern der Jahreszahl überspringen
i + 4 ; Die 5 Zeichen der Variable "%yyyy" überspringen
Continue
ElseIf Mid(Mask, i, 3) = "%yy"
IsVariableFound = #True
Year = Val(Mid(Date, DatePos, 2))
DatePos + 2 ; Die 2 Nummern der Jahreszahl überspringen
i + 2 ; Die 3 Zeichen der Variable "%yy" überspringen
Continue
EndIf
If Mid(Mask, i, 3) = "%mm"
IsVariableFound = #True
Month = Val(Mid(Date, DatePos, 2))
DatePos + 2 ; Die 2 Nummern der Monatszahl überspringen
i + 2 ; Die 3 Zeichen der Variable "%mm" überspringen
Continue
EndIf
If Mid(Mask, i, 3) = "%dd"
IsVariableFound = #True
Day = Val(Mid(Date, DatePos, 2))
DatePos + 2 ; Die 2 Nummern der Tageszahl überspringen
i + 2 ; Die 3 Zeichen der Variable "%dd" überspringen
Continue
EndIf
If Mid(Mask, i, 3) = "%hh"
IsVariableFound = #True
Hour = Val(Mid(Date, DatePos, 2))
DatePos + 2 ; Die 2 Nummern der Stundenzahl überspringen
i + 2 ; Die 3 Zeichen der Variable "%hh" überspringen
Continue
EndIf
If Mid(Mask, i, 3) = "%ii"
IsVariableFound = #True
Minute = Val(Mid(Date, DatePos, 2))
DatePos + 2 ; Die 2 Nummern der Minutenzahl überspringen
i + 2 ; Die 3 Zeichen der Variable "%ii" überspringen
Continue
EndIf
If Mid(Mask, i, 3) = "%ss"
IsVariableFound = #True
Second = Val(Mid(Date, DatePos, 2))
DatePos + 2 ; Die 2 Nummern der Sekundenzahl überspringen
i + 2 ; Die 3 Zeichen der Variable "%ss" überspringen
Continue
EndIf
If Not IsVariableFound
ProcedureReturn 0
EndIf
Else
ProcedureReturn 0
EndIf
EndIf
DatePos + 1
Next
ProcedureReturn Date64(Year, Month, Day, Hour, Minute, Second)
EndProcedure
EndModule
CompilerIf #PB_Compiler_IsMainFile
;-Test
UseModule Date64
Debug "Kleiner Kompatibilitäts-Test - Fehler:"
For Year = 1970 To 2037
For Month = 1 To 12
For Day = 1 To 28
For Hour = 0 To 23
;For Minute = 0 To 59
;For Second = 0 To 59
d1 = Date(Year, Month, Day, Hour, Minute, Second)
d2 = Date64(Year, Month, Day, Hour, Minute, Second)
If d1 <> d2
Debug d1
Debug d2
Debug ""
EndIf
d1$ = FormatDate("%yyyy.%mm.%dd %hh:%ii:%ss", d1)
d2$ = FormatDate64("%yyyy.%mm.%dd %hh:%ii:%ss", d2)
If d1$ <> d2$
Debug d1$
Debug d2$
Debug ""
EndIf
;Next Second
;Next Minute
Next Hour
Next Day
Next Month
Next Year
Debug "------------------------"
Debug "DayOfWeek --------------"
Debug DayOfWeek(Date())
Debug DayOfWeek64(Date64())
Debug "DayOfYear --------------"
Debug DayOfYear(Date())
Debug DayOfYear64(Date64())
Debug "------------------------"
Debug "Date(1600,1,1,0,0,0): " + FormatDate("%yyyy.%mm.%dd %hh:%ii:%ss", Date(1600,1,1,0,0,0))
Debug "Date64(2300,1,1,0,0,0): " + FormatDate64("%yyyy.%mm.%dd %hh:%ii:%ss", Date64(2300,1,1,0,0,0))
Debug "Date(1971,8,20,0,0,0): " + FormatDate("%yyyy.%mm.%dd %hh:%ii:%ss", Date(1971,8,20,0,0,0))
Debug "Date64(1971,8,20): " + FormatDate64("%yyyy.%mm.%dd %hh:%ii:%ss", Date64(1971,8,20))
Debug "Aktuelles Datum --------"
Debug FormatDate("%yyyy.%mm.%dd %hh:%ii:%ss", Date())
Debug FormatDate64("%yyyy.%mm.%dd %hh:%ii:%ss", Date64())
Debug "Aktuelles UTC-Datum ----"
Debug FormatDate64("%yyyy.%mm.%dd %hh:%ii:%ss", LocalDateAsUTC64())
Debug "------------------------"
a = Date64(2000, 1, 2, 11, 22, 33)
Debug "Date64(2000, 1, 2, 11, 22, 33) => Year64(): " + Year64(a)
Debug "Date64(2000, 1, 2, 11, 22, 33) => Month64(): " + Month64(a)
Debug "Date64(2000, 1, 2, 11, 22, 33) => Day64(): " + Day64(a)
Debug "Date64(2000, 1, 2, 11, 22, 33) => Hour64(): " + Hour64(a)
Debug "Date64(2000, 1, 2, 11, 22, 33) => Minute64(): " + Minute64(a)
Debug "Date64(2000, 1, 2, 11, 22, 33) => Second64(): " + Second64(a)
Debug "Aktuelles UTC-Datum ----"
a = LocalDateAsUTC64()
Debug FormatDate64("%yyyy.%mm.%dd %hh:%ii:%ss", a)
Debug "UTC plus eine Stunde ---"
a = AddDate64(a, #PB_Date_Hour, 1)
Debug FormatDate64("%yyyy.%mm.%dd %hh:%ii:%ss", a)
CompilerEndIf