Module: Jekyll::UnixDateFilter
- Defined in:
- jekyll/_plugins/unix-date.rb
Instance Method Summary collapse
- #date2seconds(input) ⇒ Object
- #unix_date(input, format) ⇒ Object
- #unixms_date(input, format) ⇒ Object
Instance Method Details
#date2seconds(input) ⇒ Object
50 51 52 53 54 |
# File 'jekyll/_plugins/unix-date.rb', line 50 def date2seconds(input) unless input.nil? Date.strptime(input, "%m/%d/%Y").to_time.to_i end end |
#unix_date(input, format) ⇒ Object
36 37 38 39 40 41 |
# File 'jekyll/_plugins/unix-date.rb', line 36 def unix_date(input, format) unless input.nil? input_with_timezone = input.to_s + ' ' + Time.now.zone DateTime.strptime(input_with_timezone,'%s %Z').strftime(format) end end |
#unixms_date(input, format) ⇒ Object
42 43 44 45 46 47 48 |
# File 'jekyll/_plugins/unix-date.rb', line 42 def unixms_date(input, format) unless input.nil? input_in_seconds = input / 1000 unix_date(input_in_seconds,format) # DateTime.strptime(input_in_seconds.to_s,'%s').strftime(format) end end |