timmah1 Posted March 17, 2009 Share Posted March 17, 2009 How would I go about adding 1 Year to a date pulled from the database? Here is what I have $setup = date("F j, Y", strtotime($a['setup'])); $expires = date("F j, Y ", strtotime($setup '+1 year')); But I get an error. Thanks in advance Link to comment https://forums.phpfreaks.com/topic/149756-solved-add-year-to-date/ Share on other sites More sharing options...
.josh Posted March 17, 2009 Share Posted March 17, 2009 example #3 in the manual entry for date shows you how to do that. It even gives +1 year as the example. Doesn't hurt to actually read the manual, you know. Link to comment https://forums.phpfreaks.com/topic/149756-solved-add-year-to-date/#findComment-786384 Share on other sites More sharing options...
timmah1 Posted March 17, 2009 Author Share Posted March 17, 2009 If I was using mktime(), then that would be helpful to me, but I'm not. Am I just overlooking something? $expires = date("Y-m-d", strtotime($a['setup']) . " +1 Year"); Link to comment https://forums.phpfreaks.com/topic/149756-solved-add-year-to-date/#findComment-786389 Share on other sites More sharing options...
.josh Posted March 17, 2009 Share Posted March 17, 2009 why don't you try doing it like the manual suggests. I think they know how to do it better than you. Link to comment https://forums.phpfreaks.com/topic/149756-solved-add-year-to-date/#findComment-786394 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.