I have a problem. I want to store current date+ time in my database. I was trying to make a migration like
current_time:date
and
current_time=DateTime.now
but it stores current date only, also i was trying to do
current_time:time
in migration. and then
current_time=Time.now
or
current_time=DateTime.now
But it stores only current time, another parametres are 2000-01-01. What I am doing wrong?
Thanks in advance.
Use
timestampin your migration. Of causedateonly stores dates andtimeonly stores time buttimestampstores the secounds since the 01.01.1970 00:00 and that an absolute time definition.To add some days you can do