Class: Time
- Inherits:
-
Object
- Object
- Time
- Defined in:
- lib/ib-ruby/extensions.rb
Overview
Add method to_ib to render datetime in IB format (zero padded “yyyymmdd HH:mm:ss”)
Instance Method Summary collapse
Instance Method Details
#to_ib ⇒ Object
3 4 5 6 |
# File 'lib/ib-ruby/extensions.rb', line 3 def to_ib "#{year}#{sprintf("%02d", month)}#{sprintf("%02d", day)} " + "#{sprintf("%02d", hour)}:#{sprintf("%02d", min)}:#{sprintf("%02d", sec)}" end |