jeff5656 Posted November 16, 2010 Share Posted November 16, 2010 I can determine 3 years from today, but How do determineo 3 years from march 1st? So I want to echo out "3/1/2013"? Thanks! Link to comment https://forums.phpfreaks.com/topic/218886-3-years-from-a-certain-date/ Share on other sites More sharing options...
AbraCadaver Posted November 16, 2010 Share Posted November 16, 2010 date('m/d/Y', strtotime('3/1/2010 +3 years')); Link to comment https://forums.phpfreaks.com/topic/218886-3-years-from-a-certain-date/#findComment-1135186 Share on other sites More sharing options...
jeff5656 Posted November 16, 2010 Author Share Posted November 16, 2010 Well the problem with that is that it assumes the current year is 2010. This wouldn't work next year right? (because it assumes 3/1/2010) Link to comment https://forums.phpfreaks.com/topic/218886-3-years-from-a-certain-date/#findComment-1135194 Share on other sites More sharing options...
simshaun Posted November 16, 2010 Share Posted November 16, 2010 So you want 3 years from the current year? echo date('Y-m-d', strtotime('March 1 + 3 years')); Link to comment https://forums.phpfreaks.com/topic/218886-3-years-from-a-certain-date/#findComment-1135200 Share on other sites More sharing options...
AbraCadaver Posted November 16, 2010 Share Posted November 16, 2010 Well the problem with that is that it assumes the current year is 2010. This wouldn't work next year right? (because it assumes 3/1/2010) Use what simshaum showed or this is easier if you always want 3 years from 3/1/current_year: '3/1/'.(date('Y')+3); I was assuming that you had the start date in a variable or something and wanted to do a calculation. Link to comment https://forums.phpfreaks.com/topic/218886-3-years-from-a-certain-date/#findComment-1135205 Share on other sites More sharing options...
jeff5656 Posted November 16, 2010 Author Share Posted November 16, 2010 Thanks guys! Link to comment https://forums.phpfreaks.com/topic/218886-3-years-from-a-certain-date/#findComment-1135207 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.