[REBOL] Re: add/subtract with date!
From: brett:codeconscious at: 15-Nov-2000 15:17
Oops left in a couple of unnecessary "probes" at the end of my add-months
function - just delete them.
Also, while we are playing around with dates I thought I'd pass on another
Rebol allows you to add a time to a date. Like so
>> start-time: now
>> end-time: start-time + 2:00
But you cannot get the time interval using a simple operator (correct me if
>> end-time - start-time
But using my datetime-subtract function you can
>> datetime-subtract end-time start-time
Here 'tis (expanded for readability)
datetime-subtract: function [
"Subract one date from another returning time between them."
][delta-days delta-hhmmss a-hhmmss b-hhmmss]
delta-days: subtract a/date b/date
a-hhmmss: either a/time [a/time][00:00:00]
b-hhmmss: either b/time [b/time][00:00:00]
return add multiply 24:00:00 delta-days (subtract a-hhmmss b-hhmmss)