Gene_Tani
(Gene Tani)
1
ActiveSupport Time#to_date
http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Time/Conversions.html#M000327
you should be aware that SQL server and Oracle have had gotchas
concerning Date and Datetime objects, tho i don't recall specifics
now.
Gene_Tani
(Gene Tani)
2
This will do seconds:
irb(main):005:0> require "date"
=> true
irb(main):006:0> d = Date.parse("1950-01-01")
=> #<Date: 4866565/2,0,2299161>
irb(main):007:0> d.strftime("%s")
=> "-631152000"
irb(main):008:0> d.strftime("%s").to_i
=> -631152000
Cheers,
Tyler