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
Link to comment
Share on other sites

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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.