Deserializes JSON
string by converting Julian year y
, month m
, day d
and Day of Calendar Reform sg
to Date
.
Returns a hash, that will be turned into a JSON
object and represent this object.
Stores class name (Date
) with Julian year y
, month m
, day d
and Day of Calendar Reform sg
as JSON
string
Duplicates self and resets its offset.
d = DateTime.new(2001,2,3,4,5,6,'-02:00') #=> #<DateTime: 2001-02-03T04:05:06-02:00 ...> d.new_offset('+09:00') #=> #<DateTime: 2001-02-03T15:05:06+09:00 ...>
Returns a Time
object which denotes self.
Returns self.
Deserializes JSON
string by converting year y
, month m
, day d
, hour H
, minute M
, second S
, offset of
and Day of Calendar Reform sg
to DateTime
.
Returns a hash, that will be turned into a JSON
object and represent this object.
Stores class name (DateTime
) with Julian year y
, month m
, day d
, hour H
, minute M
, second S
, offset of
and Day of Calendar Reform sg
as JSON
string
Returns self.
Returns a DateTime
object which denotes self.
Returns a hash, that will be turned into a JSON
object and represent this object.
Stores class name (Time
) with number of seconds since epoch and number of microseconds for Time
as JSON
string
Returns the offset in seconds between the timezone of time and UTC.
t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC t.gmt_offset #=> 0 l = t.getlocal #=> 2000-01-01 14:15:01 -0600 l.gmt_offset #=> -21600
Returns the offset in seconds between the timezone of time and UTC.
t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC t.gmt_offset #=> 0 l = t.getlocal #=> 2000-01-01 14:15:01 -0600 l.gmt_offset #=> -21600
Returns the value of time as an integer number of seconds since the Epoch.
t = Time.now "%10.5f" % t.to_f #=> "1270968656.89607" t.to_i #=> 1270968656
Returns the number of microseconds for time.
t = Time.now #=> 2007-11-19 08:03:26 -0600 "%10.6f" % t.to_f #=> "1195481006.775195" t.usec #=> 775195
Returns the number of nanoseconds for time.
t = Time.now #=> 2007-11-17 15:18:03 +0900 "%10.9f" % t.to_f #=> "1195280283.536151409" t.nsec #=> 536151406
The lowest digits of to_f
and nsec
are different because IEEE 754 double is not accurate enough to represent the exact number of nanoseconds since the Epoch.
The more accurate value is returned by nsec
.
Calls the block once for each [key, value] pair in the database. Returns self.