Module: XeroGateway::Dates::ClassMethods
- Defined in:
- lib/xero_gateway/dates.rb
Instance Method Summary collapse
- #format_date(time) ⇒ Object
- #format_date_time(time) ⇒ Object
- #parse_date(time) ⇒ Object
- #parse_date_time(time) ⇒ Object
-
#parse_utc_date_time(time) ⇒ Object
eg: 2011-09-14T10:15:03.893.
Instance Method Details
#format_date(time) ⇒ Object
8 9 10 |
# File 'lib/xero_gateway/dates.rb', line 8 def format_date(time) return time.strftime("%Y-%m-%d") end |
#format_date_time(time) ⇒ Object
12 13 14 |
# File 'lib/xero_gateway/dates.rb', line 12 def format_date_time(time) return time.strftime("%Y%m%d%H%M%S") end |
#parse_date(time) ⇒ Object
16 17 18 |
# File 'lib/xero_gateway/dates.rb', line 16 def parse_date(time) Date.civil(time[0..3].to_i, time[5..6].to_i, time[8..9].to_i) end |
#parse_date_time(time) ⇒ Object
20 21 22 |
# File 'lib/xero_gateway/dates.rb', line 20 def parse_date_time(time) Time.local(time[0..3].to_i, time[5..6].to_i, time[8..9].to_i, time[11..12].to_i, time[14..15].to_i, time[17..18].to_i) end |
#parse_utc_date_time(time) ⇒ Object
eg: 2011-09-14T10:15:03.893
25 26 27 |
# File 'lib/xero_gateway/dates.rb', line 25 def parse_utc_date_time(time) Time.utc(time[0..3].to_i, time[5..6].to_i, time[8..9].to_i, time[11..12].to_i, time[14..15].to_i, time[17..18].to_i) end |