Jump to content

i feel so stupid asking a noob question about date()


leeming

Recommended Posts

Try this:
[code]<?php
$dt = date('Y-m-d');
$dt31 = date('Y-m-d,strtotime($dt . ' + 31 days'));
echo $dt . '<br>' . $dt31;
?>[/code]
or
[code]<?php
$one_day = 86400; // number of seconds in a day
$dt = '2006-07-20'; //arbitrary date
$dt31 = date('Y-m-d',strtotime($dt)+(86400 * 31)));
echo $dt . '<br>' . $dt31;
?>[/code]

Ken
trying to get this to work, bit over tired, and cant think stright...
[code]"update Premium set date_renew = ".date ('Y-m-d', strtotime("+31 days ".`date_renew`.""))." WHERE user='{$_POST[user]}'"[/code]

but the curdate code i tried before, i couldnt get to work.. some thing like..

[code]"update Premium set date_renew =`date_renew` + (CURDATE() + INTERVAL ".$daynums." DAY) WHERE user='{$_POST[user]}'""[/code]

~~ $daynums been a value of either 31 (month) or 365 (year)



~~edit 2..
fixed!

[code]"update Premium set date_renew =DATE_ADD(`date_renew`, INTERVAL $daynums DAY) WHERE user='{$_POST[user]}'"[/code]

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.