const EPSILON = 1e-06;
EPSILON
.
const OFFSET_DISTANT_FUTURE = 1e+100;
const OFFSET_DISTANT_PAST = -OFFSET_DISTANT_FUTURE;
const SECONDS_PER_DAY = 86400.0;
const ABSOLUTE_REFDATE = 730486;
static public double relative_offset;
load
,
ensuring a high accuracy of dates near the moment in time during
which this program is running.
static public Date distant_future;
static public Date distant_past;
double (now) relativeTimeIntervalSinceNow post now > 0.0;
relative_offset
it is now.
double timeIntervalSinceReferenceDate;
(int, double) absoluteAndSecondsOfTimeInterval double ti;
int absoluteFromGregorian (int, int, int) (year, month, day);
(year, month, day)
. The Gregorian date Sunday, December 31, 1
BC is imaginary.
int absoluteFromIso (int, int, int) (year, week, day);
(year,
week, day)
in which week
is in the range 1..52 and day
is in the
range 0..6 (1 == Monday, 2 == Tuesday, ..., 0 == Sunday). The
Gregorian date Sunday, December 31, 1 BC is imaginary.
int dayNameOnOrBefore (int, int) (day_name, absolute);
day_name
on or before
absolute
. day_name
==0 means Sunday, day_name
==1 means Monday,
and so on.
Note: Applying this function to absolute
+6 gives us the day_name
on or after an absolute day d. Similarly, applying it to absolute
+3
gives the day_name
nearest to absolute
, applying it to
absolute
-1 gives the day_name
previous to absolute
, and applying
it to absolute
+7 gives the day_name
following absolute
.
int dayNumber (int, int, int) (year, month, day);
(year, month,
day)
. For example, dayNumber (1, 1, 1987) returns the value 1,
while dayNumber (12, 31, 1980) returns 366.
int dayOfWeekOfAbsolute int absolute;
absolute
where
0==Sunday, 1==Monday, ..., 6==Saturday.
(int, int, int) gregorianFromAbsolute int date;
boolean isLeapYear int year;
TRUE
iff year is a Gregorian leap year.
(int, int, int) isoFromAbsolute int absolute;
absolute
. The ISO year corresponds approximately to the
Gregorian year, but weeks start on Monday and end on Sunday. The
first week of the ISO year is the first such week in which at least 4
days are in a year. The ISO commercial date has the form (year week
day) in which week is in the range 1..52 and day is in the range 0..6
(1 = Monday, 2 = Tuesday, ..., 0 = Sunday). The absolute date is the
number of days elapsed since the (imaginary) Gregorian date Sunday,
December 31, 1 BC.
int lastDayOfMonth int month year int year;
month
of the year
year
.
void load MutableArray arguments;
Date now;
protected double relativeTimeIntervalOfAbsoluteAndSeconds (int, double) (absolute, seconds);
double timeIntervalOfAbsoluteAndSeconds (int, double) (absolute, seconds);
double relative_ti;
int compare id other;
other
0 if the
difference is smaller that EPSILON
and 1 if the receiver is
after other
.
id dateWithOffset double ti;
ti
seconds after the
receiver.
Date earlierDate Date other;
other
if it is earlier than the receiver, return the
receiver otherwise.
boolean equals id d;
TRUE
iff the receiver is within EPSILON
seconds
of d
.
protected id init double d;
id init;
id initWithTimeIntervalSinceNow double ti;
ti
seconds after the current time.
id initWithTimeIntervalSinceReferenceDate double ti;
ti
seconds after the absolute reference date
January 1, 2001.
Date laterDate Date other;
other
iff it is later than the receiver, return the
receiver otherwise.
protected double relativeTimeInterval;
relative_offset
double timeIntervalSinceDate Date d;
d
. This number is
negative if the receiver is earlier than d
.
double timeIntervalSinceNow;
double timeIntervalSinceReferenceDate;
OutputStream write OutputStream s;
void encodeUsingCoder Encoder coder;
void initWithCoder Decoder coder;