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!
current date + 7 days
Moderator: General Moderators
- aerodromoi
- Forum Contributor
- Posts: 230
- Joined: Sun May 07, 2006 5:21 am
Re: current date + 7 days
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);Usually i find http://www.php.net/strtotime easier than mktime 
Code: Select all
<?php
echo date('d.m.Y', strtotime('+7 days'));
?>- aerodromoi
- Forum Contributor
- Posts: 230
- Joined: Sun May 07, 2006 5:21 am
Each to their own, I suppose.timvw wrote:Usually i find http://www.php.net/strtotime easier than mktime
Code: Select all
<?php echo date('d.m.Y', strtotime('+7 days')); ?>
I usually work with timestamps and convert them only for the actual output. And 604800 isn't too bad ,)
aerodromoi
-
AshrakTheWhite
- Forum Commoner
- Posts: 69
- Joined: Thu Feb 02, 2006 6:47 am
- aerodromoi
- Forum Contributor
- Posts: 230
- Joined: Sun May 07, 2006 5:21 am
I wouldn't say that...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
Code: Select all
<?php
$yourmodifiedtimestamp= date("U") + 604800;
echo date("d.m.Y",$yourmodifiedtimestamp);
?>-
AshrakTheWhite
- Forum Commoner
- Posts: 69
- Joined: Thu Feb 02, 2006 6:47 am