i really confised about display tomorrows date format dd.mm.yyyy ?
$now_date2 = mktime('23','59','00',date("n"),date("j")+1,date("Y"));
what is wrong with this ?
Any helps thanks.
i really confised about display tomorrows date format dd.mm.yyyy ?
$now_date2 = mktime('23','59','00',date("n"),date("j")+1,date("Y"));
what is wrong with this ?
Any helps thanks.
Do you mean something like this:
<?php echo date('d.m.Y', strtotime(' +1 day')); ?>
You want to display tomorrow's date, but you're assigning a timestamp to a variable. If you want to assign tomorrow's timestamp to a variable you can just do:
$now_date2 = strtotime('+1 day');
or as jack said in his comment:
$now_date2 = strtotime('tomorrow');
then you can display as desired like so:
echo date('d.m.Y', $now_date2);
You need to format the timestamp it creates.
$now_date2 = date('d.m.Y', mktime('23','59','00',date("n"),date("j")+1,date("Y")));
$now_date2 isn't going to be in format dd.mm.yyyy it's actually in seconds from January 1, 1970 with the time zone offset, so it is often dec 31, 1969 for me because I'm gmt -6 at 0. This number is known as the unix timestamp. In order to get it into something you will understand you need to use date() and supply the time stamp you made, so like this:
date("d.m.Y", mktime('23','59','00',date("n"),date("j")+1,date("Y")));
Would produce dd.mm.yyyy, but if you go to php.net/manual/en/function.date.php it'll give you all the formats you can put in for the first argument. Someone above gave an answer that is much simplier than you are trying to do as well of:
date('d.m.Y', strtotime(' +1 day'));
strtotime will try and convert english to a timestamp and then once you have a timestamp you can use date to do anything you want with it.
Look at the following: http://php.net/manual/en/function.date.php http://php.net/manual/en/function.mktime.php
If you want to format a date then use date("format") where format can be any combination of parameters as listed in the date manual (i.e. dd.mm.yyyy would be date("d.m.Y")
).
If you are trying to format a specific time into that format (and not simply the current time), then you can create a unix timestamp using mktime()
and pass that to the date()
function.
Example: date("d.m.Y", mktime(0, 0, 0, 12, 13, 2012))
--> 13.12.2012