Skip to content
Fix Code Error

Finding the number of days between two dates

March 13, 2021 by Code Error
Posted By: Anonymous

How to find number of days between two dates using PHP?

Solution

$now = time(); // or your date as well
$your_date = strtotime("2010-01-31");
$datediff = $now - $your_date;

echo round($datediff / (60 * 60 * 24));
Answered By: Anonymous

Related Articles

  • Reference — What does this symbol mean in PHP?
  • Select from table by knowing only date without time (ORACLE)
  • get next and previous day with PHP
  • How to echo with different colors in the Windows…
  • Getting the difference between two Dates…
  • How to calculate the difference between two dates using PHP?
  • Calculate time difference in minutes in SQL Server
  • How do you rotate canvas element to mouse position,…
  • Getting time difference between two times in PHP
  • Reference - What does this regex mean?
  • PHP parse/syntax errors; and how to solve them
  • Group array of objects by multiple keys using d3.groups
  • Calculate business days
  • How to convert java.util.Date to java.sql.Date?
  • Increase days to php current Date()
  • How to return only the Date from a SQL Server…
  • getting error while updating Composer
  • round() for float in C++
  • Fix top buttons on scroll of list below
  • Get current date, given a timezone in PHP?
  • Add number of days to a date
  • Execute a PHP script from another PHP script
  • SQL Server Group By Month
  • D3 chart integration into Vuejs
  • How to get previous month and year relative to…
  • Convert Java Date to UTC String
  • PHP Error: Cannot use object of type stdClass as…
  • PHP check if date between two dates
  • Custom date picker in Vuetify
  • How do I count unique visitors to my site?
  • PHP - add 1 day to date format mm-dd-yyyy
  • Blazor Can't Update UI
  • What's the difference between Instant and LocalDateTime?
  • Adding 1 hour to time variable
  • How to calculate age (in years) based on Date of…
  • Get first day of week in SQL Server
  • How do you round to 1 decimal place in Javascript?
  • "Notice: Undefined variable", "Notice: Undefined…
  • PHP Converting Integer to Date, reverse of strtotime
  • Convert one date format into another in PHP
  • PHP mysql insert date format
  • Echo a blank (empty) line to the console from a…
  • How to round an average to 2 decimal places in PostgreSQL?
  • Return current date plus 7 days
  • I'm working on pagination for my project. How do I…
  • How can i use `parse = T` and functions like round…
  • Alternative to header("Content-type: text/xml");
  • Removing double quotes from variables in batch file…
  • How To Edit Date and Time Picker Vuejs Vuetify From…
  • How do I get the number of days between two dates in…
  • Using VBA unable to get the difference between two…
  • The number of method references in a .dex file…
  • Rails Active Record find(:all, :order => ) issue
  • How to obtain the start time and end time of a day?
  • How to get the first and last date of the current year?
  • PHP Adding 15 minutes to Time value
  • Sort table rows In Bootstrap
  • Strtotime() doesn't work with dd/mm/YYYY format
  • $date + 1 year?
  • PHP for loop Show the entries in ascending order by quantity
  • PostgreSQL: days/months/years between two dates
  • How to compare two dates in php
  • Is this request generated by EF Core buggy or is it my code?
  • Converting between java.time.LocalDateTime and…
  • get an array of dates from today for datepicker with…
  • PHP + JQuery - How to use these two together? Please…
  • How do I extract data from JSON with PHP?
  • how to fix Invalid request (Unsupported SSL request)…
  • Using if(isset($_POST['submit'])) to not display…
  • Convert a PHP script into a stand-alone windows executable
  • Generating a drop down list of timezones with PHP
  • T-SQL datetime rounded to nearest minute and nearest…
  • Subtracting Dates in Oracle - Number or Interval Datatype?
  • convert php date to mysql format
  • How to compare two dates to find time difference in…
  • How do you create a Swift Date object?
  • Avoid creating new session on each axios request laravel
  • How can I execute PHP code from the command line?
  • I have these 2 tonnage calculators. The first one is…
  • Function to Convert Date
  • Java string to date conversion
  • How to check if a date is greater than another in Java?
  • PHP - Failed to open stream : No such file or directory
  • How to calculate age in T-SQL with years, months, and days
  • Adding one day to a date
  • bootstrap-datepicker in dd/mm/yyyy - selected date…
  • Adding days to $Date in PHP
  • How do you parse and process HTML/XML in PHP?
  • How does PHP 'foreach' actually work?
  • Adding three months to a date in PHP
  • Pass a PHP array to a JavaScript function
  • Using CTE in Oracle SQL (ORA-00923: FROM keyword not…
  • How can I change color of date on the datepicker vuetify?
  • First echo missing when using bash -c over SSH
  • Current time formatting with Javascript
  • Is there a quick way for checking whether a date…
  • Why does Math.Round(2.5) return 2 instead of 3?
  • Adding 30 minutes to time formatted as H:i in PHP
  • Vuetify - Rules should return a string or boolean,…
  • Removing an array item from Firestore not working…

Disclaimer: This content is shared under creative common license cc-by-sa 3.0. It is generated from StackExchange Website Network.

Post navigation

Previous Post:

Where can I find php.ini?

Next Post:

Get the value of checked checkbox?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

.net ajax android angular arrays aurelia backbone.js bash c++ css dataframe ember-data ember.js excel git html ios java javascript jquery json laravel linux list mysql next.js node.js pandas php polymer polymer-1.0 python python-3.x r reactjs regex sql sql-server string svelte typescript vue-component vue.js vuejs2 vuetify.js

  • you shouldn’t need to use z-index
  • No column in target database, but getting “The schema update is terminating because data loss might occur”
  • Angular – expected call-signature: ‘changePassword’ to have a typedeftslint(typedef)
  • trying to implement NativeAdFactory imports deprecated method by default in flutter java project
  • What should I use to get an attribute out of my foreign table in Laravel?
© 2022 Fix Code Error