s.nagesh
Joined: 23 Jul 2007 Posts: 131
|
Posted: Wed Jul 02, 2008 8:47 am Post subject: New Methods for Date Time Class |
|
|
Three new methods were added to DateTime class. The
methods are #utc, #utc? and #utc_offset. Look an example for each one:
date = DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24))
#=> Mon, 21 Feb 2005 10:11:12 -0600
date.utc
#=> Mon, 21 Feb 2005 16:11:12 +0000
>> DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)).utc?
#=> false
>> DateTime.civil(2005, 2, 21, 10, 11, 12, 0).utc?
#=> true
>> DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)).utc_offset
#=> -21600 |
|