Page 1 of 1
current date + 7 days
Posted: Sat May 13, 2006 4:57 am
by AshrakTheWhite
how do i do that?
using timestamps and mktime i can get the unix timestamp for 7 days from now, but how do i reformat it back to d.m.y format?
what i need this for is to have the date of entry incremented by 7 aka a week and apparently date('d.m.y') dosent let me just add 7 to the days, and i dont know how to convert out of unix timestamp into normal date format.
Thanx for help!
Re: current date + 7 days
Posted: Sat May 13, 2006 5:09 am
by aerodromoi
AshrakTheWhite wrote:how do i do that?
using timestamps and mktime i can get the unix timestamp for 7 days from now, but how do i reformat it back to d.m.y format?
what i need this for is to have the date of entry incremented by 7 aka a week and apparently date('d.m.y') dosent let me just add 7 to the days, and i dont know how to convert out of unix timestamp into normal date format.
Thanx for help!
Code: Select all
$newstamp = date("d.m.Y",$yourmodifiedtimestamp);
aerodromoi
Posted: Sat May 13, 2006 9:01 am
by timvw
Usually i find
http://www.php.net/strtotime easier than mktime
Code: Select all
<?php
echo date('d.m.Y', strtotime('+7 days'));
?>
Posted: Sat May 13, 2006 9:33 am
by aerodromoi
Each to their own, I suppose.
I usually work with timestamps and convert them only for the actual output. And 604800 isn't too bad ,)
aerodromoi
Posted: Sat May 13, 2006 9:53 am
by AshrakTheWhite
both of those output unix timestamps, what i need is the opposite, i need a non unix time out of an unix timestamp
Posted: Sat May 13, 2006 10:04 am
by aerodromoi
AshrakTheWhite wrote:both of those output unix timestamps, what i need is the opposite, i need a non unix time out of an unix timestamp
I wouldn't say that...
Code: Select all
<?php
$yourmodifiedtimestamp= date("U") + 604800;
echo date("d.m.Y",$yourmodifiedtimestamp);
?>
aerodromoi
Posted: Sat May 13, 2006 10:19 am
by AshrakTheWhite
try before you judge

, sorry for the agony :p
works perfect cheers
