Class: DateTime

Inherits:
Object
  • Object
show all
Defined in:
lib/ofx/1.0.2/serializer.rb

Instance Method Summary collapse

Instance Method Details

#to_ofx_102_s(extended = true) ⇒ Object



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/ofx/1.0.2/serializer.rb', line 102

def to_ofx_102_s(extended=true)
    s = strftime('%Y%m%d%H%M%S')

    if extended
        # some servers need exactly 3 decimal places for sec_fraction
        s = s + '.000'

        # use Time class to return TZ in correct format for OFX
        #  ie. ("EDT" vs. "-07:00")
        tz = to_time.zone
        s = s + '[0:' + tz + ']' if tz
    end

    return s
end

#to_ofx_102_s_defunctObject



98
99
100
# File 'lib/ofx/1.0.2/serializer.rb', line 98

def to_ofx_102_s_defunct
    strftime('%Y%m%d%H%M%S.') + (sec_fraction * 86400000000).to_i.to_s + '[' + offset.numerator.to_s + ':' + strftime('%Z') + ']'
end

#to_timeObject



94
95
96
# File 'lib/ofx/1.0.2/serializer.rb', line 94

def to_time
    Time.parse(self.to_s)
end