Solved

Date difference - calculate days

Posted on 2013-12-21
2
341 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

863 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now