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.
| Property | Description |
|---|---|
| .year | Year |
| .month | Month |
| .day | Day |
| .wday | Day of week |
| .yday | Day of year |
| .hour | Hour of the day using 24 hour clock |
| .min | Minute |
| .sec | Seconds |
| .usec | Microseconds |
| .zone | Timezone |

