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 Link to comment https://forums.phpfreaks.com/topic/45254-how-to-get-a-future-date-after-180-days-after-present-day/ 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 Link to comment https://forums.phpfreaks.com/topic/45254-how-to-get-a-future-date-after-180-days-after-present-day/#findComment-219708 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())); Link to comment https://forums.phpfreaks.com/topic/45254-how-to-get-a-future-date-after-180-days-after-present-day/#findComment-219712 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); Link to comment https://forums.phpfreaks.com/topic/45254-how-to-get-a-future-date-after-180-days-after-present-day/#findComment-219713 Share on other sites More sharing options...
jitesh Posted April 2, 2007 Share Posted April 2, 2007 select DATE_ADD(CURDATE(),INTERVAL 180 DAY) Link to comment https://forums.phpfreaks.com/topic/45254-how-to-get-a-future-date-after-180-days-after-present-day/#findComment-219718 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"; ?> Link to comment https://forums.phpfreaks.com/topic/45254-how-to-get-a-future-date-after-180-days-after-present-day/#findComment-219728 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. Link to comment https://forums.phpfreaks.com/topic/45254-how-to-get-a-future-date-after-180-days-after-present-day/#findComment-219763 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.