News for hackers. Stuff that matters.
Re:Arrow: Better dates and times for Python by draegtun on Wednesday August 06, 2014 @08:10AM (#8142046)
Rebol comes built-in with nice date & time features.

While it doesn't have all the bells and whistles you would get with a 3rd party library like the one posted here it does have an advantage that date & time are both first class datatypes:

  >> type? 6-Aug-2014
  == date!

  >> type? 01:20:59   ;  1 hour, 20 mins and 59 secs
  == time!
 
  >> 6/8/2014 - 5/8/2014
  == 1
 
  >> difference 6/8/2014 5/8/2014
  == 24:00

  >> yesterday: now - 1
  == 5-Aug-2014/13:12:33+1:00

  >> yesterday/day
  == 5
 
  >> one-hour-twenty-mins: 1:20
  == 1:20
 
  >> one-hour-twenty-mins/minute
  == 20
 
  >> one-hour-twenty-mins/hour 
  == 1

  >> two-hours: one-hour-twenty-mins + 0:40 
  == 2:00
refs: http://www.rebol.com/r3/docs/datatypes/date.html | http://www.rebol.com/r3/docs/datatypes/time.html

There are no comments on this comment yet.