Class: LocaSMS::Helpers::DateTimeHelper
- Inherits:
-
Object
- Object
- LocaSMS::Helpers::DateTimeHelper
- Defined in:
- lib/locasms/helpers/date_time_helper.rb
Overview
Helper class to handle with time parsing
Class Method Summary collapse
-
.parse(date) ⇒ Object
Parse a value into a time.
-
.split(date) ⇒ Object
Breaks a given date in date and time.
Class Method Details
.parse(date) ⇒ Object
Parse a value into a time
19 20 21 22 23 24 |
# File 'lib/locasms/helpers/date_time_helper.rb', line 19 def self.parse(date) date = Time.at(date) if date.is_a? Integer date = Time.parse(date) if date.is_a? String date = date.to_time if date.respond_to? :to_time date end |
.split(date) ⇒ Object
Breaks a given date in date and time
38 39 40 |
# File 'lib/locasms/helpers/date_time_helper.rb', line 38 def self.split(date) parse(date).strftime('%d/%m/%Y %H:%M').split end |