Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Date difference - calculate days

Posted on 2013-12-21
2
343 Views
Last Modified: 2013-12-22
I have the following and need to calculate days between the start and end date

$start=ISODate("2013-12-22T04:26:57.140Z");
$end=ISODate("2013-11-22T04:26:57.140Z");

I need to do this in php with the iso date format as above
0
Comment
Question by:debbieau1
2 Comments
 
LVL 16

Accepted Solution

by:
Peter Kwan earned 500 total points
ID: 39734334
You may use the following:

$start="2013-12-22T04:26:57.140Z";
$end="2013-11-22T04:26:57.140Z";
echo abs(strtotime($end)-strtotime($start)) / (24*60*60);

Open in new window

0
 
LVL 1

Author Closing Comment

by:debbieau1
ID: 39734406
Thanks
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question