3

I have a column name late with datatype time without time zone. my requirement is to read all the rows which is late more than by 1 hours. I have to query through my rails application. In table column value is like 00:31:00 but in rails it is like 2000-01-01 00:31:00 UTC. How to query directly or by using ActiveRecords?

1 Answer 1

1

When you can directly access the time in rails as '2000-01-01 00:31:00 UTC', then use the code

require 'time'
standard_time_for_comparison = '2000-01-01 00:31:00 UTC'
(Time.now - Time.parse(standard_time_for_comparison))/3600 > 1

Change standard_time_for_comparison according to your needs.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.