Date problem

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

 



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