Time Object Methods Used to Access Date/Time Attributes : Time class « Time « Ruby






Time Object Methods Used to Access Date/Time Attributes


Method      What the Method Returns 
hour        A number representing the hour in 24-hour format (21 for 9 p.m., for example).
min         The number of minutes past the hour.
sec         The number of seconds past the minute.
usec        The number of microseconds past the second (there are 1,000,000 microseconds per second).
day         The number of the day in the month.
mday        Synonym for the day method, considered to be "month" day.
wday        The number of the day in terms of the week (Sunday is 0, Saturday is 6).
yday        The number of the day in terms of the year.
month       The number of the month of the date (11 for November, for example).
year        The year associated with the date.
zone        Returns the name of the time zone associated with the time.
utc?        Returns true or false depending on if the time/date is in the UTC/GMT time zone or not.
gmt?        Synonym for the utc? method for those who prefer to use the term GMT.

 








Related examples in the same category

1.Time Introduction
2.Time represented internally as seconds since the (platform-dependent) epoch