afsar Posted April 2, 2007 Share Posted April 2, 2007 hi friends i would like to create a application where i am storing present date. and also want to mention expiration date 180 days from present day, how to do it using php, i am using mysql as my database. please kindly help me Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted April 2, 2007 Share Posted April 2, 2007 look at the strtotime() something like $date = time() $future = strtotime("$date + 180 days"); good luck Quote Link to comment Share on other sites More sharing options...
mjlogan Posted April 2, 2007 Share Posted April 2, 2007 echo date("d-m-Y", strtotime("+180 day", time())); Quote Link to comment Share on other sites More sharing options...
vbnullchar Posted April 2, 2007 Share Posted April 2, 2007 $today=getdate(); $d= mktime(0,0,0,$today['mon'],$today['wday']+180,$today['year']); echo date('d/m/Y',$d); Quote Link to comment Share on other sites More sharing options...
jitesh Posted April 2, 2007 Share Posted April 2, 2007 select DATE_ADD(CURDATE(),INTERVAL 180 DAY) Quote Link to comment Share on other sites More sharing options...
neel_basu Posted April 2, 2007 Share Posted April 2, 2007 Test It ------------------------------ <?php header("Content-Type: text/plain"); echo "Timestamps\n"; echo "Current Time Timestamp ".strtotime("now"), "\n"; echo "180th Time Timestamp ".strtotime("+180 days"), "\n"; ?> Quote Link to comment Share on other sites More sharing options...
obsidian Posted April 2, 2007 Share Posted April 2, 2007 hi friends i would like to create a application where i am storing present date. and also want to mention expiration date 180 days from present day, how to do it using php, i am using mysql as my database. please kindly help me I'm trying to fully understand this. If you are referencing the expiration date as 180 days from the present date, the account with never expire. If you are defining the signup date as the current date at time of signup and an expiration date at the same time, you'll just need to do something like this: INSERT INTO myTable (signup_date, exp_date) VALUES (NOW(), NOW() + INTERVAL 180 DAY); Hope this helps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.