Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8364955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:33:04+00:00 2026-06-09T12:33:04+00:00

Seems like this should be a simple thing to do, but the date/time operations

  • 0

Seems like this should be a simple thing to do, but the date/time operations in postgresql are killing me. All I’m looking to do is search for items older than 10 minutes. Coding language is PHP.

Field event_time is: timestamp without time zone NOT NULL

$sql = "SELECT * FROM incidents WHERE 
        event_time < ( now() - interval '-{$threshold} minutes' )
        AND submitted=0 "; 

This query is returning all results instead of items older than 10 minutes. Do I need to type cast that event_time field somehow?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:33:06+00:00Added an answer on June 9, 2026 at 12:33 pm

    By using a negative threshold value, you have a double negative, so you are searching for everything less than ten minutes in the future (which would naturally return everything). Just use interval '{$threshold} minutes}'

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seems like this should be simple, but powershell is winning another battle with me.
This seems like it should be really simple, but I'm unable to figure this
This seems like it should be so simple, but apparently it isn't. I have
This seems like it should be very simple but I can't get it to
This feels like it should be pretty simple, but not much seems to be
It seems that this should be a simple thing but I can't figure it
This seems like it should be a simple task, but I'm a noob as
This seems like it should be simple, but maybe I'm missing something. I just
Seems like this should be obvious, but how do I send arrow key presses
This seems like it should be easy, but I can't quite find an explanation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.