Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] ANN: subtract-dates

From: rebol-list2::seznam::cz at: 6-Jun-2003 16:19

Librarian comment

In recent versions of REBOL, use difference to subtract two dates.

Hello rebol-list, 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]