Rozamunda
asked on
year 5 years ago
How to find a year which was 5 years ago in PHP.
Like now we have 2011. I would like to have my starting year as "06" (with leading zeros)
Like now we have 2011. I would like to have my starting year as "06" (with leading zeros)
Are you searching a database? array? textfile?
What is your dateformat?
What is your dateformat?
ASKER
jsherz: it shows 69 ( ???)
stu215: i want to get "06" for the current year, next year i would like to get "07" .
What do you mean date format ? in php.ini ?
stu215: i want to get "06" for the current year, next year i would like to get "07" .
What do you mean date format ? in php.ini ?
stu215: That's odd - on my installation it shows 2006.
Try this:
Try this:
<?php
$current_year = (int)date("Y");
$current_year = $current_year - 5;
echo($current_year);
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Using date() :
Y = A full numeric representation of a year, 4 digits Examples: 1999 or 2003
y = A two digit representation of a year Examples: 99 or 03
Y = A full numeric representation of a year, 4 digits Examples: 1999 or 2003
y = A two digit representation of a year Examples: 99 or 03
ASKER
the provided solutions did not answer my question
Open in new window