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

  • Home
  • SEARCH
  • 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 7937271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:29:09+00:00 2026-06-03T22:29:09+00:00

I have a row from an SQL table, and one field is a DATE.

  • 0

I have a row from an SQL table, and one field is a DATE. (The value may be undefined, as DATE has no default value). How can I tell if this date, if it exists, is still in the future?

I searched for answers and found lots of ways to extract all records that pass this test, but I don’t want to do that. I just want to check this one previously extracted record. Sorry for the newbie question!

$userQuery  = "SELECT * FROM  `passwords` WHERE `name` = '$name' LIMIT 1";
$userResult     = mysql_query($userQuery);    
$userRow        = mysql_fetch_assoc($userResult); 
$bestBeforeDate = $userRow['bestBeforeDate']; // field is in DATE format
// what now? How to find if the 'best Before Date' has passed?
  • 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-03T22:29:11+00:00Added an answer on June 3, 2026 at 10:29 pm

    You can do it in SQL as additional column

    select case when (current_timestamp < date_column) 
                then 1
                else 0
                end as is_in_future
    from your_table
    

    EDIT

    You can do this in one query while reading other values from your table.
    Example (not knowing the column names of your table)

    select id,
           date_column,
           other_column,
           case when (current_timestamp < date_column) 
                then 1
                else 0
           end as is_in_future
    from your_table
    where some_conditions
    

    Example output:

    id  date_column   other_column   is_in_future
     1  2012-01-01    abc            0
     2  2012-08-01    def            1
     ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form field where one of the values has a default value
I have a requirement where I have to drop one row from a table
If I were to select a row from a table I basically have two
I have this code right now to get the row value from jquery grid..
I have a HTML table as follows. I want retrieve row values from this
I have as a result from a dynamic query a table with only one
I have one table called gallery . For each row in gallery there are
I have a table which contains rows, within each row there is a field
I replicate a table from one SQL Server 2008 instance to another which already
I have a table that is populated from a SQL database. Most of the

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.