Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Date difference - calculate days

Posted on 2013-12-21
2
Medium Priority
?
348 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
[X]
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
2 Comments
 
LVL 16

Accepted Solution

by:
Peter Kwan earned 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

604 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