Time / Date Calculation

Post Reply
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Time / Date Calculation

Post by Jeff Barnes »

Hi Everybody,

Does anyone know of a formula to calculate a Date and Time based on elapsed time in seconds from a certain date.

ie: The date is Jan 01 1990, Elapsed time in seconds from midnight of that date would be 572778954.

How would I get the date time of the above?
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Hello Jeff

Post by ukoenig »

I got all needed functions of data and time calculations
They are some at : http://www.pflegeplus.com/fivewin

I must look in my archiv, if this function is included
otherwise i put it in the forum

Regards
Uwe
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Post by StefanHaupt »

Jeff,

this code should work

Code: Select all

nSec := 572778954     // eleapsed seconds
nDays := Int (nSec/86400)   // get the days, 1 day = 86400 secs
nMod := nSec%86400          // get the rest
nHours := Int (nMod/3600)   // get the hours, 1 hour = 3600 secs
nMin := Int ((nMod%3600)/60)   // get the minutes

dToday := Date ()
dDate := dToday - nDays
cTime := StrZero(nHours,2,0)+":"+StrZero(nMin,2,0)
kind regards
Stefan
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Date / Time

Post by ukoenig »

Hello Stefan,

did you have look at my Topic Date / Time => Elapsed-Function ?
With this function you have some more informations.

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Post by Jeff Barnes »

Thanks Uwe and Stefan, I will give your ideas a try.
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: Date / Time

Post by StefanHaupt »

Hi Uwe,
ukoenig wrote: did you have look at my Topic Date / Time => Elapsed-Function ?
With this function you have some more informations.
not yet, but i´ll do it
kind regards
Stefan
Post Reply