Introduction To Ruby
Dates & Times

The Time class can be used for working with dates and times.

# Get current date and time
t = Time.now

# Set date to 01/02/2010
tt = Time.local(2010, 2, 1)

The following tables shows properties that you can access for the date.

PropertyDescription
.yearYear
.monthMonth
.dayDay
.wdayDay of week
.ydayDay of year
.hourHour of the day using 24 hour clock
.minMinute
.secSeconds
.usecMicroseconds
.zoneTimezone