module NginxTail::TimeLocal
Public Class Methods
to_date(time_local)
click to toggle source
>> DateTime.strptime(“13/Apr/2010:04:45:51 +0100”, ‘%d/%b/%Y:%T %z’).to_s
> “2010-04-13T04:45:51+01:00”¶ ↑
>> DateTime.strptime(“13/Apr/2010:04:45:51 +0100”, ‘%d/%b/%Y:%H:%M:%S %z’).to_s
> “2010-04-13T04:45:51+01:00”¶ ↑
>> _
# File lib/ntail/time_local.rb, line 15 def self.to_date(time_local) DateTime.strptime(time_local, '%d/%b/%Y:%T %z') end
to_date_s(time_local, format = "%Y-%m-%d %X")
click to toggle source
# File lib/ntail/time_local.rb, line 19 def self.to_date_s(time_local, format = "%Y-%m-%d %X") self.to_date(time_local).strftime(format) end
Public Instance Methods
to_date()
click to toggle source
# File lib/ntail/time_local.rb, line 29 def to_date self.class.to_date(self.time_local) end
to_date_s()
click to toggle source
# File lib/ntail/time_local.rb, line 33 def to_date_s self.class.to_date_s(self.time_local) end