vchris 3 Posted March 23, 2007 Report Share Posted March 23, 2007 I have something like this in my text: "It's been 8 years...". In a year it won't be 8 years it'll be 9 years. So I'd like to create a counter that will increase the years every year and I'm not sure how to do this in php. Quote Link to post Share on other sites
PrateekSaxena 1 Posted March 23, 2007 Report Share Posted March 23, 2007 <?php$year = date("Y");echo $year-1999; Will this work? Quote Link to post Share on other sites
smiles 7 Posted March 23, 2007 Report Share Posted March 23, 2007 <?php$my_t=getdate(date("U"));$countYear= $my_t[year]-1999;echo $countYear;?> http://www.w3schools.com/php/func_date_getdate.asp Quote Link to post Share on other sites
PrateekSaxena 1 Posted March 23, 2007 Report Share Posted March 23, 2007 Isn't that the same as the code that I wrote? I mean in functionality? Quote Link to post Share on other sites
iyeru42 0 Posted March 23, 2007 Report Share Posted March 23, 2007 Isn't that the same as the code that I wrote? I mean in functionality?Doubtful, because smiles used "U" rather than "Y." Quote Link to post Share on other sites
Mr_CHISOL 0 Posted March 23, 2007 Report Share Posted March 23, 2007 Doubtful, because smiles used "U" rather than "Y."With "functionallity" you, in most cases, mean how "it function": The result, not the way to get the result.And nomather which you use the result will be same (number of years between 1999 and today). Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.