joshuaceo Posted January 3, 2009 Share Posted January 3, 2009 Is it possible to show todays date but 29 days after: How would I do this on this code below: $expdate = gmdate("Y-m-d"); Also just incase it is not possible. Is there a way to show todays date in exactly this format: 2009-01-02 Link to comment https://forums.phpfreaks.com/topic/139272-how-to-display-date-29-days-after-please-its-urgent/ Share on other sites More sharing options...
xtopolis Posted January 3, 2009 Share Posted January 3, 2009 strtotime As for your other question... Yes. date Link to comment https://forums.phpfreaks.com/topic/139272-how-to-display-date-29-days-after-please-its-urgent/#findComment-728494 Share on other sites More sharing options...
Nitroware Posted January 3, 2009 Share Posted January 3, 2009 Also try mktime(): <?php $time=date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+29, date("Y"))); ?> Link to comment https://forums.phpfreaks.com/topic/139272-how-to-display-date-29-days-after-please-its-urgent/#findComment-728523 Share on other sites More sharing options...
kenrbnsn Posted January 3, 2009 Share Posted January 3, 2009 Example: $expdate = gmdate("Y-m-d"); echo $expdate . "\n"; echo date('Y-m-d',strtotime($expdate . ' +29 days')) . "\n"; ?> Ken Link to comment https://forums.phpfreaks.com/topic/139272-how-to-display-date-29-days-after-please-its-urgent/#findComment-728553 Share on other sites More sharing options...
corbin Posted January 3, 2009 Share Posted January 3, 2009 Why not just use now? echo date('Y-m-d', strtotime('now +29 days')); Link to comment https://forums.phpfreaks.com/topic/139272-how-to-display-date-29-days-after-please-its-urgent/#findComment-728555 Share on other sites More sharing options...
kenrbnsn Posted January 3, 2009 Share Posted January 3, 2009 Actually, you don't even need the 'now': <?php echo date('Y-m-d',strtotime('+29 days')); ?> Ken Link to comment https://forums.phpfreaks.com/topic/139272-how-to-display-date-29-days-after-please-its-urgent/#findComment-728556 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.