I have datetime (SQL) column in my DB, and I noticed whenever I
retrieve that column using ActiveRecord, it returns an object of class
Time instead of DateTime. Does Rails convert treat datetime and time
as if they’re the same?
Eric
I have datetime (SQL) column in my DB, and I noticed whenever I
retrieve that column using ActiveRecord, it returns an object of class
Time instead of DateTime. Does Rails convert treat datetime and time
as if they’re the same?
Eric
On May 30, 5:20 pm, Eric LIn [email protected] wrote:
I have datetime (SQL) column in my DB, and I noticed whenever I
retrieve that column using ActiveRecord, it returns an object of class
Time instead of DateTime. Does Rails convert treat datetime and time
as if they’re the same?
Time and DateTime are not the same, but the behave mostly the same
(and Time is what you get by default for a datetime column).
Ruby’s Time and DateTime are not different in the way that a
database’s time and datetime are (ruby does not have a pure time of
day class).
Fred
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs