Ruby Time Functions

EditRocket provides the following information on Time functions in the Ruby source code builder.

asctime - Returns a canonical string representation of time.

at( aTime ) - Creates a new time object with the value given by aTime, or the given number of seconds (and optional microseconds) from epoch. A non-portable feature allows the offset to be negative on some systems.

ctime - Returns a canonical string representation of time.

day - Returns the day of the month (1..n) for time.

dst? - Returns true if time occurs during Daylight Saving Time in its time zone.

eql?(other_time) - Return true if time and other_time are both Time objects with the same seconds and fractional seconds.

getgm - Returns a new new_time object representing time in UTC.

getlocal - Returns a new new_time object representing time in local time (using the local time zone in effect for this process).

getutc - Returns a new new_time object representing time in UTC.

gm( year [, month, day, hour, min, sec, usec] ) - Creates a time based on given values, interpreted as UTC (GMT). The year must be specified. Other values default to the minimum value for that field (and may be nil or omitted). Months may be specified by numbers from 1 to 12, or by the three-letter English month names. Hours are specified on a 24-hour clock (0..23). Raises an ArgumentError if any values are out of range. Will also accept ten arguments in the order output by Time#to_a.

gmt? - Returns true if time represents a time in UTC (GMT).

gmt_offset - Returns the offset in seconds between the timezone of time and UTC.

gmtime - Converts time to UTC (GMT), modifying the receiver.

gmtoff - Returns the offset in seconds between the timezone of time and UTC.

hash - Return a hash code for this time object.

hour - Returns the hour of the day (0..23) for time.

httpdate(date) - Parses date as HTTP-date defined by RFC 2616 and converts it to a Time object.

httpdate(date) - Parses date as HTTP-date defined by RFC 2616 and converts it to a Time object.

inspect - Returns a string representing time. Equivalent to calling Time#strftime with a format string of ``%a %b %d %H:%M:%S %Z %Y''.

isdst - Returns true if time occurs during Daylight Saving Time in its time zone.

iso8601(fraction_digits=0) - "Alias for #xmlschema"

local( year [, month, day, hour, min, sec, usec] ) - Same as Time::gm, but interprets the values in the local time zone.

localtime - Converts time to local time (using the local time zone in effect for this process) modifying the receiver.

marshal_dump() - undocumented

marshal_load(p1) - undocumented

mday - Returns the day of the month (1..n) for time.

min - Returns the minute of the hour (0..59) for time.

mktime( year, month, day, hour, min, sec, usec ) - Same as Time::gm, but interprets the values in the local time zone.

mon - Returns the month of the year (1..12) for time.

month - Returns the month of the year (1..12) for time.

new - "Document-method: now"

now - Synonym for Time.new. Returns a Time object initialized tot he current system time.

parse(date, now=Time.now) - Parses date using Date._parse and converts it to a Time object.

rfc2822(date) - Parses date as date-time defined by RFC 2822 and converts it to a Time object. The format is identical to the date format defined by RFC 822 and updated by RFC 1123.

rfc2822(date) - Parses date as date-time defined by RFC 2822 and converts it to a Time object. The format is identical to the date format defined by RFC 822 and updated by RFC 1123.

rfc822() - "Alias for #rfc2822"

sec - Returns the second of the minute (0..60)[Yes, seconds really can range from zero to 60. This allows the system to inject leap seconds every now and then to correct for the fact that years are not really a convenient number of hours long.] for time.

strftime( string ) - Formats time according to the directives in the given format string. Any text not listed as a directive will be passed through to the output string.

succ - Return a new time object, one second later than time.

times - Deprecated in favor of Process::times

to_a - "Returns a ten-element array of values for time: {[ sec, min, hour, day, month, year, wday, yday, isdst, zone ]}. See the individual methods for an explanation of the valid ranges of each value. The ten elements can be passed directly to Time::utc or Time::local to create a new Time."

to_f - Returns the value of time as a floating point number of seconds since epoch.

to_i - Returns the value of time as an integer number of seconds since epoch.

to_s - Returns a string representing time. Equivalent to calling Time#strftime with a format string of ``%a %b %d %H:%M:%S %Z %Y''.

to_yaml( opts = {} ) -

tv_sec - Returns the value of time as an integer number of seconds since epoch.

tv_usec - Returns just the number of microseconds for time.

usec - Returns just the number of microseconds for time.

utc? - Returns true if time represents a time in UTC (GMT).

utc( year [, month, day, hour, min, sec, usec] ) - Creates a time based on given values, interpreted as UTC (GMT). The year must be specified. Other values default to the minimum value for that field (and may be nil or omitted). Months may be specified by numbers from 1 to 12, or by the three-letter English month names. Hours are specified on a 24-hour clock (0..23). Raises an ArgumentError if any values are out of range. Will also accept ten arguments in the order output by Time#to_a.

utc( year [, month, day, hour, min, sec, usec] ) - Creates a time based on given values, interpreted as UTC (GMT). The year must be specified. Other values default to the minimum value for that field (and may be nil or omitted). Months may be specified by numbers from 1 to 12, or by the three-letter English month names. Hours are specified on a 24-hour clock (0..23). Raises an ArgumentError if any values are out of range. Will also accept ten arguments in the order output by Time#to_a.

utc_offset - Returns the offset in seconds between the timezone of time and UTC.

w3cdtf(date) -

wday - Returns an integer representing the day of the week, 0..6, with Sunday == 0.

xmlschema(date) - Parses date as dateTime defined by XML Schema and converts it to a Time object. The format is restricted version of the format defined by ISO 8601.

xmlschema(date) - Parses date as dateTime defined by XML Schema and converts it to a Time object. The format is restricted version of the format defined by ISO 8601.

yaml_new( klass, tag, val ) -

yday - Returns an integer representing the day of the year, 1..366.

year - Returns the year for time (including the century).

zone - Returns the name of the time zone used for time. As of Ruby 1.8, returns ``UTC'' rather than ``GMT'' for UTC times.

zone_offset(zone, year=Time.now.year) -