Login   Register  
PHP Classes
elePHPant
Icontem

help please need months instead of weeks

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      Simple Date Time Object  >  All threads  >  help please need months instead of weeks  >  (Un) Subscribe thread alerts  
Subject:help please need months instead of weeks
Summary:Trying to add date but want months displayed instead of weeks
Messages:3
Author:won guy
Date:2005-03-18 18:53:41
Update:2005-03-20 10:52:17
 

  1. help please need months instead of weeks   Reply  
Picture of won guy
won guy
2005-03-18 18:53:41
$dto->setMySQLDateTime(variable1);
$worktime = $dto->diff_MySQL(variable2);
print "<br>"." Time to finish : ".$worktime['years']." Years ".
$worktime['months']." Weeks ".<----------(I would like this to be months)
$worktime['days']." Days ".
$worktime['hours']." Hours ".
$worktime['minutes']." Minutes ".
$worktime['seconds']." Seconds ";


can someone please help... I'd appreciate it!

  2. Re: help please need months instead of weeks   Reply  
Picture of won guy
won guy
2005-03-18 18:56:57 - In reply to message 1 from won guy
sorry this is how my caode goes:

$dto->setMySQLDateTime(variable1);
$worktime = $dto->diff_MySQL(variable2);
print "<br>"." Time to finish : ".$worktime['years']." Years".
$worktime['weeks']." Weeks ".<---------I would lie this to be months
$worktime['days']." Days ".
$worktime['hours']." Hours ".
$worktime['minutes']." Minutes ".
$worktime['seconds']." Seconds ";

I tryed to use months befor, like in my last post, but had no luck. Any solutions would be much appreciated!

  3. Re: help please need months instead of weeks   Reply  
Picture of Christian Hansel
Christian Hansel
2005-03-20 10:52:17 - In reply to message 2 from won guy
Hi,

There is currently no option "Months" implemented.

The problem with months is, that there are months with 31/30/28/29 days wich makes it a bit difficult to calculate independently from the base date.

I have not yet included a subroutine to do this and have currently no time to think about it, either.

Thinking it over the years component may be a bit inaccurate as well, since I think it does not differentiate between years with 365 and years with 366 days.

My initial idea would be to check the number of days within the current month (your variable1) and all the months up to the target months ($variable2) using date("t",date) and then do some calculations with worktime['days'].

I would of course appreciate if you would try to find a way to put this within the class and mail me the result, as I do not have the time momentarily to think about it in more detail.

Hope this helps

Chris