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 7943551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:18:11+00:00 2026-06-04T00:18:11+00:00

I have a mySQL database. I need to count the number of days between

  • 0

I have a mySQL database.

I need to count the number of days between two dates.

My client is going to fill an input hm_date with January 1, 1979 via php form to create a new record.

I need a field total_days to calculate the total number of days from hm_date to the present day. I need this field to always update itself with each passing day.

How do I make hm_date to appear with total days and be always updated?

I asume this can be achieved server-side?

Should I use strototime() ?

  • 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-04T00:18:13+00:00Added an answer on June 4, 2026 at 12:18 am

    You’ll want to use MySQL’s DATEDIFF()

    DATEDIFF() returns expr1 – expr2 expressed as a value in days from one
    date to the other. expr1 and expr2 are date or date-and-time
    expressions. Only the date parts of the values are used in the
    calculation.

    mysql> SELECT DATEDIFF('2007-12-31 23:59:59','2007-12-30');
            -> 1
    mysql> SELECT DATEDIFF('2010-11-30 23:59:59','2010-12-31');
            -> -31
    

    Based on your question I think you would want DATE_DIFF(hm_date, CURRENT_DATE). Just make sure hm_date is in YYYY-MM-DD format.

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

Sidebar

Related Questions

I have a MySQL database, and a particular table in that database will need
Here my code, I need to insert into mysql database I have mysql,php,android 1)
I have table which contains double values stored in mysql database ...I need to
I have a dropdown menu that is filled by a mysql database. I need
I have s MySQL database and I need to insert some specific data in
I have table in MySQL database with two integer columns for example: userid |
I have a number mysql database field named numbers in which there are 10
I have a MySql database with three tables I need to combine in a
I have a MySQL database table which holds 6 types of records I need
I have a MySQL database with two tables in it: Members - id, name,

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.