RE: Date problem

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

 



<snip>
> // Do some number crunching here //
> 
> $newnow = $now-$numweeks;
> 
> echo $now;
> 
> $converted_date = date("d-m-y",$now);
> 
> echo "<br>$converted_date";

</snip>

You should be running your $convewrted_date on $newnow, not $now




Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
"Pay It Forward"
mailto:gary.every@ingramentertainment.com
http://accessingram.com


> -----Original Message-----
> From: Chris Payne [mailto:chris@planetoxygene.com]
> Sent: Monday, July 14, 2003 3:45 AM
> To: php
> Subject:  Date problem
> 
> 
> Hi there everyone,
> 
> I use the below code to grab the current date, convert it to 
> a unix timestamp to do some bits then it's supposed to change 
> the date back with the new values (IE: current date - x 
> amount of seconds) but it's not doing it correctly, it's 
> probably DEAD obvious to everyone as my brain has probably 
> fried :-)  But here's the code, when I convert it back to 
> d,m,Y it says it's 2004 which it shouldn't.
> 
> Thanks
> 
> Chris
> 
> ---
> 
> $secsinweek = 604800;
> 
> $numweeks = $secsinweek * 7;
> 
> $curdate = date("d-m-Y");
> 
> // Split the strings into day, month, year
> list($cd, $cm, $cy) = split("-", $curdate);
> 
> // Create unix time stamps for the start and end date
>  $now = mktime(0,0,0,$cd,$cm,$cy);
> 
> // Do some number crunching here //
> 
> $newnow = $now-$numweeks;
> 
> echo $now;
> 
> $converted_date = date("d-m-y",$now);
> 
> echo "<br>$converted_date";
> 

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux