Class TimeInfo

extends Object
A decomposed view of a Time object.

Class summary


MONDAY -> any
Weekday representation of Monday.
TUESDAY -> any
Weekday representation of Tuesday.
WEDNESDAY -> any
Weekday representation of Wednesday.
THURSDAY -> any
Weekday representation of Thursday.
FRIDAY -> any
Weekday representation of Friday.
SATURDAY -> any
Weekday representation of Saturday.
SUNDAY -> any
Weekday representation of Sunday.

Statics

FRIDAY -> any
Weekday representation of Friday.

MONDAY -> any
Weekday representation of Monday.

SATURDAY -> any
Weekday representation of Saturday.

SUNDAY -> any
Weekday representation of Sunday.

THURSDAY -> any
Weekday representation of Thursday.

TUESDAY -> any
Weekday representation of Tuesday.

WEDNESDAY -> any
Weekday representation of Wednesday.

Methods

operator == other/any -> bool
Whether this object is equal to the other.
By default, identical is used for equality.
Inheritance
Classes overwrite this operator to get an equality specific to their needs. Equality operators often compare the type and field contents. For example:

class Pin:
  number/int

  constructor .number:

  operator == other:
    if other is not Pin: return false
    return number == other.number
A class doesn't have to follow the above format, but it must keep the operator in sync with any hash-code method. That is, if a class has a hash-code member, then the equality and hash-code must agree. If two instances are equal (a == b), then their hash codes must also be equal (a.hash-code == b.hash-code).

plus --years/int=0 --months/int=0 --days/int=0 --h/int=0 --m/int=0 --s/int=0 --ms/int=0 --us/int=0 --ns/int=0 -> TimeInfo
Adds the given parameters to this time info.
Takes daylight-saving changes into account. Adding a day is thus not always equivalent to adding 24 hours.

Converts this instance to a date string of the form 'yyyy-mm-dd'.
Hours, minutes and seconds are ignored.

Converts this instance to an string conforming to RFC 3339, which is a subset of ISO 8601.
For example, the time of the first moonlanding would be written as: 1969-07-20T20:17:00Z.
To get a string that is rounded down to the nearest second use (my-time-info.with --ns=0).to-iso8601-string.

with --year/int=year --month/int=month --day/int=day --h/int=h --m/int=m --s/int=s --ns/int=ns --dst/bool=null -> TimeInfo
Creates a new TimeInfo with the given parameters updated.

Fields

Day of the month.
In the range 1-31.

h / int
Hours after midnight.
In the range 0-23.

Whether this instance is computed with daylight saving active.

Whether this instance is in UTC.

m / int
Minutes after the hour.
In the range 0-59.

Month of the year.
In the range 1-12.

Nanoseconds after the second.
In the range 0-999_999_999.

s / int
Seconds after the minute.
Generally in the range 0 to 59. May be 60 in case of leap-seconds.

The corresponding time instance.

Weekday.
In accordance with ISO 8601, the week starts with Monday having the value 1.
When using a weekday for indexing, it is often convenient to take the weekday value module 7, which gives a value in the range 0 to 6, but shuffles Sunday down to the beginning of the week.

Year.

Days since January 1st.
In the range 1-366.
In combination with the year also known as ordinal date.