The problem is that the variable 'd' is first used to store the value of the selected date, then it is used almost immediately after to store the day value of that date. The subsequent calls to get values for 'h', 'i', and 's' are then going to be incorrect. See the following:
Code: Select all
OpenWindow(0,0,0,200,240,"",$ca0001)
CreateGadgetList(WindowID(0))
CalendarGadget(0,10,10,180,160)
TextGadget(1,10,180,180,20,"",#PB_Text_Border|#PB_Text_Center)
TextGadget(2,10,210,180,20,"",#PB_Text_Border|#PB_Text_Center)
Repeat
e=WaitWindowEvent()
If e=#PB_Event_Gadget
If EventGadget()=0
date=GetGadgetState(0) ; <- Changed from 'd' to 'date'
; |
y=Val(FormatDate("%yyyy",date)) ; <-
m=Val(FormatDate("%mm",date)) ; <-
d=Val(FormatDate("%dd",date)) ; <-
h=Val(FormatDate("%hh",date)) ; <-
i=Val(FormatDate("%ii",date)) ; <-
s=Val(FormatDate("%ss",date)) ; <-
SetGadgetText(1,"Clicked date : "+Str(Date(y,m,d,h,i,s)))
SetGadgetText(2,"+ 00:00:00: "+Str(Date(y,m,d,00,00,00)))
EndIf
EndIf
Until e=16
"Ahead one third... ahead two thirds... Full ahead flank
And out from the belly of the whale came a prophet, Amen"