Class: Fixnum
- Inherits:
-
Object
- Object
- Fixnum
- Defined in:
- lib/core_ext/core_ext.rb
Overview
Fixnum Extensions ==============================================================================
Instance Method Summary collapse
-
#to_hrs_mins_secs ⇒ Object
Given a number of seconds, convert into a string like HH:MM:SS.
Instance Method Details
#to_hrs_mins_secs ⇒ Object
Given a number of seconds, convert into a string like HH:MM:SS
175 176 177 178 179 |
# File 'lib/core_ext/core_ext.rb', line 175 def to_hrs_mins_secs _now = DateTime.now _d = Date::day_fraction_to_time((_now + self.seconds) - _now) "#{sprintf('%02d',_d[0])}:#{sprintf('%02d',_d[1])}:#{sprintf('%02d',_d[2])}" end |