RE: Get Time betwen dates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks a lot!

 

 

 

 

From
http://groups.google.com/group/comp.lang.php/browse_frm/thread/594ee5f268a0f
a
08/50cb49624610df9f?lnk=gst&q=difference+between+dates#50cb49624610df9f :-

$oldtime = strtotime("2004-01-05"); 
$time = time(); 
$elapsed = $time - $oldtime; 
$years = date('Y', $elapsed) - 1970; 
$months = date('n', $elapsed); 
$days = date('j', $elapsed); 
echo "Time elapsed: $years years, $months months, $days days"; 

-----Original Message-----
From: php-objects@xxxxxxxxxxxxxxx <mailto:php-objects%40yahoogroups.com>
[mailto:php-objects@xxxxxxxxxxxxxxx <mailto:php-objects%40yahoogroups.com> ]
On
Behalf Of Jean Carlo
Sent: 21 October 2008 21:00
To: php-objects@xxxxxxxxxxxxxxx <mailto:php-objects%40yahoogroups.com> 
Subject:  Get Time betwen dates

Hi all pros, I want subtract 2 Dates on PHP but I want that the result give
me:

I introduce a old date "2007-09-19" and today's date (2008-10-21).

And the function returs: 1 year, 1month and 2 day.

Did you know or have any function to do that?

Regards! ^.^

[Non-text portions of this message have been removed]

------------------------------------

Are you looking for a PHP job? Join the PHP Professionals directory Now!
http://www.phpclasses.org/professionals/Yahoo! Groups Links

****************************************************************************
*******
Any opinions expressed in email are those of the individual and not
necessarily those of the company. This email and any files transmitted with
it are confidential and solely for the use of the intended recipient 
or entity to whom they are addressed. It may contain material protected by
attorney-client privilege. If you are not the intended recipient, or a
person responsible for delivering to the intended recipient, be advised that
you have received this email in error and that any use is strictly
prohibited.

Random House Group + 44 (0) 20 7840 8400
http://www.randomhouse.co.uk
http://www.booksattransworld.co.uk 
http://www.kidsatrandomhouse.co.uk
Generic email address - enquiries@xxxxxxxxxxxxxxxxx
<mailto:enquiries%40randomhouse.co.uk> 

Name & Registered Office:
THE RANDOM HOUSE GROUP LIMITED
20 VAUXHALL BRIDGE ROAD
LONDON
SW1V 2SA
Random House Group Ltd is registered in the United Kingdom with company No.
00954009, VAT number 102838980
****************************************************************************
*******

 

No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.175 / Virus Database: 270.8.2/1739 - Release Date: 10/22/2008
7:23 AM



[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux