Forum: Ruby on Rails difference in time between Rails and Mysql timestamps

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Tam K. (Guest)
on 2009-04-23 10:17

I have on my database table column called effective_start_date which
tracks when the record should start to be active.

So if I want the record to be active instantly I say something like:

the_record.effective_start_date =

and then I search for it instantly after with query condition like:

SELECT * FROM ... (sms_clients.effective_start_date IS NULL OR
sms_clients.effective_start_date <

Which wouldn't find the record!!!

After looking in DB I realized there is small difference with time
between one recorded in MySQL and the one generated by Rails query. I
have Debian VPS. It doesn't happen when I design on my local Mac

I can get around the issue in different ways but I thought MySql and
Rails should use system time so they should be identical. Do you have
any idea why they might be different and how to make them same so I
don't run in similar problems in future.


This topic is locked and can not be replied to.