SCook Posted December 3, 2007 Share Posted December 3, 2007 Hi all, Is there a way, or a built in function, that I can send in a date, and an increment, 7 days later, for example, and the function would kick back the calander date in mm/dd/yyyy? For example: $newDate = getNewDate('12/3/2007', 7); and it would kick out '12/9/2007'? or whatever is neccesary? The reaosn is that instead of creating code to figure it out, there mustbe a way that it can be donw automaticcally. After all, the bios knows the calendar. Any suggestions would be greatly appreciated Link to comment https://forums.phpfreaks.com/topic/80027-getting-a-future-date/ Share on other sites More sharing options...
pcman Posted December 3, 2007 Share Posted December 3, 2007 like that?: <?php $new_date = time()+7*24*60*60;//the future date ?> Link to comment https://forums.phpfreaks.com/topic/80027-getting-a-future-date/#findComment-405486 Share on other sites More sharing options...
Orio Posted December 3, 2007 Share Posted December 3, 2007 Use strtotime(): <?php $timestamp = strtotime($date) + strtotime("+7 days") - time(); echo date("...", $timestamp); //choose the format ?> Orio. Link to comment https://forums.phpfreaks.com/topic/80027-getting-a-future-date/#findComment-405490 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.