Module: Aio::Base::Toolkit::Date

Defined in:
lib/aio/base/toolkit/date.rb

Class Method Summary collapse

Class Method Details

.month_to_i(str) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/aio/base/toolkit/date.rb', line 4

def month_to_i(str)
  return   case str
          when /(?i)Jan/
            "01"
          when /(?i)Feb/
            "02"
          when /(?i)Mar/
            "03"
          when /(?i)Apr/
            "04"
          when /(?i)May/
            "05"
          when /(?i)Jun/
            "06"
          when /(?i)Jul/
            "07"
          when /(?i)Aug/
            "08"
          when /(?i)Sep/
            "09"
          when /(?i)Oct/
            "10"
          when /(?i)Nov/
            "11"
          when /(?i)Dec/
            "12"
          else
            "unknow"
          end
end

.time_to_s(arr) ⇒ Object

arr = [time, zone, week, year, month, day]



36
37
38
39
40
41
42
# File 'lib/aio/base/toolkit/date.rb', line 36

def time_to_s(arr)
  year   = arr[3]
  month = arr[4]
  day  = arr[5]
  time   = arr[0]
  format("%s-%s-%s %s", year, month, day, time)
end