2 docSlot("today", "Set the receiver to the current date, no time information
3 is included. See `now' for the current date and time.")
4 today
:= method(Date now
setHour(0) setMinute(0) setSecond(0))
6 docSlot("isToday", "Returns true if the receiver's date is today's date.")
9 now year
== year
and now month
== month
and now day
== day
12 docSlot("secondsToRun(expression)", "Evaluates message and returns a Number
13 whose value is the number of seconds taken to do the evaluation")
14 secondsToRun
:= method(
16 call
relayStopStatus(call
evalArgAt(0))
17 dt
:= Date clone now
secondsSince(t1
)
20 docSlot("asAtomDate", "Returns the date formatted as a valid atom date (rfc4287) in the system's timezone.")
21 Date asAtomDate
:= method(
22 asString("%Y-%m-%dT%H:%M:%S") .. gmtOffset asMutable
atInsertSeq(3, ":")
24 justSerialized
:= method(stream
,
25 stream
write("Date clone do(",
26 "setYear(", self year
, ") ",
27 "setMonth(", self month
, ") ",
28 "setDay(", self day
, ") ",
29 "setHour(", self hour
, ") ",
30 "setMinute(", self minute
, ") ",
31 "setSecond(", self second
, ")",
37 docSlot("years", "Returns Duration of receiver's years.
42 ==> 1 years 00 days 00:00:0.000000
44 ==> 20 years 00 days 00:00:0.000000
47 With this, you can do things such as:
49 Io> Date clone now + 5 years
50 ==> 2011-11-14 18:44:33 EST
51 Io> Date clone now + 2 years + 3 days + 22 minutes
52 ==> 2008-11-17 19:06:54 EST
55 years
:= method(Duration clone setYears(self))
57 docSlot("days", "Returns Duration of receiver's days. See `years' for a
59 days
:= method(Duration clone setDays(self))
61 docSlot("hours", "Returns Duration of receiver's hours. See `years' for a
63 hours
:= method(Duration clone setHours(self))
65 docSlot("minutes", "Returns Duration of receiver's minutes. See `years' for
67 minutes
:= method(Duration clone setMinutes(self))
69 docSlot("seconds", "Returns Duration of receiver's seconds. See `years' for
71 seconds
:= method(Duration clone setSeconds(self))
75 docSlot("+", "Returns a new Duration of the two added.")
76 setSlot("+", method(d
, self clone += d
))
78 docSlot("-", "Returns a new Duration of the two subtracted.")
79 setSlot("-", method(d
, self clone -= d
))