class Rubyvis::Format::Date

Attributes

pattern[R]

Public Class Methods

new(pattern) click to toggle source
# File lib/rubyvis/format/date.rb, line 6
def initialize(pattern)
  @pattern=pattern
  #@pad=Rubyvis::Format.pad
end

Public Instance Methods

format(d) click to toggle source
# File lib/rubyvis/format/date.rb, line 10
def format(d)
  d.strftime(pattern)
end
format_lambda() click to toggle source
# File lib/rubyvis/format/date.rb, line 13
def format_lambda
  pat=pattern
  lambda {|d| 
    d.strftime(pat)
  }
end
parse(s) click to toggle source
# File lib/rubyvis/format/date.rb, line 19
def parse(s)
  time=::DateTime.strptime(s, pattern)
  Time.utc(time.year, time.month, time.day, time.hour, time.min, time.sec, 0)
end