[REBOL] Re: ANN: subtract-dates
From: lmecir:mbox:vol:cz at: 7-Jun-2003 20:07
> is there any simple way how to subtract 2 dates?
> I had to write this function:
>
> subtract-dates: func[
> "Returns the second date subtracted from the first in time!
datatype."
> end [date!] start [date!]
> /local time days
> ][
> if end < start [return negate subtract-dates end start]
> time: (either none? end/time [0:0][end/time]) - (either none?
start/time [0:0][start/time])
> either 0 < days: end/day - start/day [(days * 24:00) + time][
time ]
> ]
>
> ;so for example this will return time since 1-1-2003:
> subtract-dates now 1-1-2003
>
> --
> Best regards,
> rebOldes mailto:[rebol-list2--seznam--cz]
I am using a function, that doesn't return a time! value for a long time.
Is this property of your function intended?
>> subtract-dates 22/4/2003 21/3/2003
== 24:00