Method: Time#-
- Defined in:
- lib/source/ruby.rb
#-(time) ⇒ Object
call-seq:
time - other -> float
time - numeric -> time
Difference – returns a new time that represents the difference between two times, or subtracts the given number of seconds in numeric from time.
t = Time.now #=> Tue Sep 23 2008 22:10:22 GMT-0400 (EDT)
t2 = t + 2592000 #=> Thu Oct 23 2008 22:10:22 GMT-0400 (EDT)
t2 - t #=> 2592000.0
t2 - 2592000 #=> Tue Sep 23 2008 22:10:22 GMT-0400 (EDT)
6302 6303 6304 |
# File 'lib/source/ruby.rb', line 6302 def -(time) `typeof(time)=='number'?new(Date)(this._value.valueOf()-(time*1000)):(this._value.valueOf()-time._value.valueOf())/1000` end |