Forum Moderators: coopster
<?php
$no="4";
$prepare=mktime (0,0,0,date("m") ,date("d")+$no,date("Y"));
$future=strftime("%d-%m-%Y",$prepare);
echo "$no days from now is $future";
?>
... and when I run it, I get:
4 days from now is 03-01-2006
I want the line to read:
4 days from now is Tuesday, January 3rd
Can anyone assist me in changing the script to yield my desired output?
But it only looks like your date format is off a little bit. Instead of
$future=strftime("%d-%m-%Y",$prepare);
i would try
$future=strftime("%A, %B %d",$prepare);
source of suggestion: [us3.php.net...]
good luck!
<?phpWhich produces
$today = date("d-m-Y");
$no="4";
$advance = "+$no days";
$prepare = strtotime($advance);
$future = date("d-m-Y", $prepare);
echo "Today is $today. $no days from now is $future";
?>
Today is 02-01-2006. 4 days from now is 06-01-2006
It gives the desired result. I even checked to make sure it took into account days near the end of the year. If anyone sees anything wrong with this, even I would appreciate a response.
Hope it helps!
IamStang