How can I convert a result from a dDate dialog into a correct date format with DAYSTODATE ?
dDate and DAYSTODATE
Roman wrote:How can I convert a result from a dDate dialog into a correct date format with DAYSTODATE ?
try this:
PROC Datum:
LOCAL jahr%, monat%, tag%, Date&, int%
dINIT "Datum"
dDATE Date&,"Datum",DAYS(01,01,1980),DAYS(31,12,2099)
int%=DIALOG
IF int%=0 : return : ENDIF
DaysToDate Date&, jahr%, monat%, tag%
print FIX$( tag%,0,2)+"."+FIX$(monat%,0,2)+"."+FIX$(jahr%,0,4)
get
ENDP
Marukusu
Thanks ! And what about this ?
The result of dTime shall be convertet in hours and minutes. How does it works ?
dTime takes the time in seconds after midnight, so converting is done like this:
from hour, minute, second to value for dTIME:
dtimesecs& = HOUR*3600 + MINUTE*60 + SECONDfrom dTIME value back to hour minutes and seconds:
H%=0 : M%=0 : S%=0
WHILE dtimesecs&>=3600
H%=H%+1
dtimesecs&=dtimesecs&-3600
ENDWH
WHILE dtimesecs&>=60
M%=M%+1
dtimesecs&=dtimesecs&-60
ENDWH
S%=dtimesecs&or alternatively:
H%=dtimesecs&/3600
dtimesecs&=dtimesecs&-(INT(H%)*3600)
M%=dtimesecs&/60
dtimesecs&=dtimesecs&-(INT(M%)*60)
S%=dtimesecs&