Class representing a date and time.

See the documentation to the file date.rb for an overview.

DateTime objects are immutable once created.

Other methods.

The following methods are defined in Date, but declared private there. They are made public in DateTime. They are documented here.


Get the hour-of-the-day of the time. This is given using the 24-hour clock, counting from midnight. The first hour after midnight is hour 0; the last hour of the day is hour 23.


Get the minute-of-the-hour of the time.


Get the second-of-the-minute of the time.


Get the fraction of a second of the time. This is returned as a Rational.


Get the time zone as a String. This is representation of the time offset such as “+1000”, not the true time-zone name.


Get the time zone offset as a fraction of a day. This is returned as a Rational.


Create a new DateTime object, identical to the current one, except with a new time zone offset of of. of is the new offset from UTC as a fraction of a day.

Show files where this class is defined (3 files)
Register or log in to add new notes.