Class: Timert::DateUtil
- Inherits:
-
Object
- Object
- Timert::DateUtil
- Defined in:
- lib/timert/date_util.rb
Class Method Summary collapse
- .format_date(date) ⇒ Object
- .format_hour(timestamp) ⇒ Object
- .format_month(date) ⇒ Object
- .parse_time(arg) ⇒ Object
Class Method Details
.format_date(date) ⇒ Object
10 11 12 |
# File 'lib/timert/date_util.rb', line 10 def self.format_date(date) date ? date.strftime("%Y-%m-%d") : "" end |
.format_hour(timestamp) ⇒ Object
6 7 8 |
# File 'lib/timert/date_util.rb', line 6 def self.format_hour() ? Time.at().strftime("%H:%M:%S") : "" end |
.format_month(date) ⇒ Object
14 15 16 |
# File 'lib/timert/date_util.rb', line 14 def self.format_month(date) date ? date.strftime("%Y-%m") : "" end |
.parse_time(arg) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/timert/date_util.rb', line 18 def self.parse_time(arg) if arg hours, minutes = arg.split(":") now = Time.now Time.new(now.year, now.month, now.day, hours, minutes).to_i end end |