Jump to content

Date not working


Recommended Posts

Hi everyone, I have this snippet of code which i need to add 7 days too

 

<?php echo $row_last_picture_date['startdate']; ?>

the above code outputs 28/05/2010

     

      Im trying to add 7 days using the code below but it outputs 07/01/1970, can anydbody see why?

 

     

      
   <?php $today = $row_last_picture_date['startdate'];
            $est = strtotime('+7 day', strtotime($today));
            print date('d/m/Y', $est); ?>

Link to comment
https://forums.phpfreaks.com/topic/203177-date-not-working/
Share on other sites

The current code I have works to an extent, it adds 7 days, but it adds it to the current date and not my DB date

 

<?php
$curdate = $row_last_picture_date['user_picture_date'];
$plus7 = date("Y-m-d",mktime(0,0,0,date("m"),date("d")+7,date("Y")));

echo $plus7;
?>" />

Link to comment
https://forums.phpfreaks.com/topic/203177-date-not-working/#findComment-1064539
Share on other sites

Have you tried this?:

<?php
  $today = $row_last_picture_date['user_picture_date'];
  $est = date(“d/m/Y”,strtotime(“+7 days”,$today));
  print date('d/m/Y', $est);
?>

The code you had a problem with adds 7 days to the date in the db, do you want code that adds 7 days to the current date?

Link to comment
https://forums.phpfreaks.com/topic/203177-date-not-working/#findComment-1064558
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.