Join the Stack Overflow Community
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I have created a method that lists future dates, the method uses psql's NOW() type. I have been instructed not to use this because the time in the database is different from the time in the system.

Example: where(concert_start_time > NOW)

This is in my rails model. Is there an alternative to using NOW().

share|improve this question
up vote 0 down vote accepted

Use a Time object

where('concert_start_time > ?', Time.now)
share|improve this answer
    
I didn't think that would work, but it did. Tests are green. Thanks! – codecalypso Mar 31 '15 at 14:16
1  
easiest way to check is to print the query and add to_sql at the end, it will show you the generated query. – Mohammad AbuShady Mar 31 '15 at 14:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.