Class: CrazyTime
- Inherits:
-
Object
- Object
- CrazyTime
- Defined in:
- lib/record/crazy_time.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ CrazyTime
constructor
A new instance of CrazyTime.
Constructor Details
#initialize ⇒ CrazyTime
Returns a new instance of CrazyTime.
4 5 |
# File 'lib/record/crazy_time.rb', line 4 def initialize end |
Class Method Details
.strptime(string) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/record/crazy_time.rb', line 7 def self.strptime(string) # Convert strings into a usable Time object. This only works for dates from MySQL. string[/(\d+)-(\d+)-(\d+)\s(\d+):(\d+):(\d+)/] year = $1.to_i; month = $2.to_i; day = $3.to_i; hour = $4.to_i; min = $5.to_i; sec = $6.to_i new_time = Time.local(year,month,day,hour,min,sec) return new_time end |