Date and Time math

New to FreeBASIC? Post your questions here.
DaveJJ
Posts: 15
Joined: Feb 14, 2015 8:42

Date and Time math

Postby DaveJJ » Feb 23, 2015 15:33

Hi,

Can someone explain what is possible in the line of calculation with Time variables. For instance, is it possible to add say 45 minutes to a time and return a time value which can be used elsewhere, sort of;

new_time = now +(45 minutes)

IF (a_different_time - new_time) == (45 minutes) THEN
........
END IF

this works

DIM time_now as DOUBLE
DIM trigger_time as DOUBLE

time_now = timevalue (now)
trigger_time = timevalue ("02:35:50")

IF time_now > triggertime_time THEN
.......
END IF

It would be nice (for me) if there was a simple way to add 2 values together

thanks
DaveJJ
Posts: 15
Joined: Feb 14, 2015 8:42

Re: Date and Time math

Postby DaveJJ » Feb 23, 2015 15:56

I think I've just answered it for myself having revisited DateAdd.

I shall have a play with the function and see if it's feasible to do what I want.

Cheers
Lothar Schirm
Posts: 359
Joined: Sep 28, 2013 15:08
Location: Germany

Re: Date and Time math

Postby Lothar Schirm » Feb 23, 2015 16:16

You may also have a look on this page: http://www.freebasic.net/wiki/wikka.php?wakka=ProPgDates (date serials and time serials).
DaveJJ
Posts: 15
Joined: Feb 14, 2015 8:42

Re: Date and Time math

Postby DaveJJ » Feb 23, 2015 16:52

Had a look and it explains a lot. Pity I didn't find it earlier.

Thanks

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 11 guests