phplover Posted April 1, 2009 Share Posted April 1, 2009 Hi, Thanks for let me joined this great helpful and informative php forum. I am a php script beginner. I am trying to make a form that calculate the start and end dates in the second and third field in the form as soon as the numbers of day is entered in the first field. For example: 1. Number of days = (let say we enter 65) 2. Today's date = (Mar 31, 2009) <-- this field should be auto populated as <?now?> or something. 3. End date = (correctly auto calculated date using field 1 and two) Please help me clearly step by step on how to do it. Thanks. Link to comment https://forums.phpfreaks.com/topic/152029-auto-calculate-date-for-beginning-and-ending-upon-the-amount-of-days/ Share on other sites More sharing options...
Q695 Posted April 1, 2009 Share Posted April 1, 2009 get the server time, then add the secconds for 65 days and set that for the experation time. $now = time(); Link to comment https://forums.phpfreaks.com/topic/152029-auto-calculate-date-for-beginning-and-ending-upon-the-amount-of-days/#findComment-798409 Share on other sites More sharing options...
Mark Baker Posted April 1, 2009 Share Posted April 1, 2009 $then = strtotime('+ 65 days'); Link to comment https://forums.phpfreaks.com/topic/152029-auto-calculate-date-for-beginning-and-ending-upon-the-amount-of-days/#findComment-798422 Share on other sites More sharing options...
Yesideez Posted April 1, 2009 Share Posted April 1, 2009 If you want to display the date after use date() eg. echo date('d-M-Y H:i:s',time()); http://php.net/date Link to comment https://forums.phpfreaks.com/topic/152029-auto-calculate-date-for-beginning-and-ending-upon-the-amount-of-days/#findComment-798423 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.