Module: XeroGateway::Dates::ClassMethods

Defined in:
lib/xero_gateway/dates.rb

Instance Method Summary collapse

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