Class: Time

Inherits:
Object
  • Object
show all
Defined in:
lib/ib-ruby/ib.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_ibObject



28
29
30
31
# File 'lib/ib-ruby/ib.rb', line 28

def to_ib
  "#{self.year}#{sprintf("%02d", self.month)}#{sprintf("%02d", self.day)} " +
  "#{sprintf("%02d", self.hour)}:#{sprintf("%02d", self.min)}:#{sprintf("%02d", self.sec)}"
end