vchris Posted March 23, 2007 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. Link to comment Share on other sites More sharing options...
PrateekSaxena Posted March 23, 2007 Share Posted March 23, 2007 <?php$year = date("Y");echo $year-1999; Will this work? Link to comment Share on other sites More sharing options...
smiles Posted March 23, 2007 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 Link to comment Share on other sites More sharing options...
PrateekSaxena Posted March 23, 2007 Share Posted March 23, 2007 Isn't that the same as the code that I wrote? I mean in functionality? Link to comment Share on other sites More sharing options...
iyeru42 Posted March 23, 2007 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." Link to comment Share on other sites More sharing options...
Mr_CHISOL Posted March 23, 2007 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). Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now