How to get current, last and coming year in PHP. Simple examples of how you can get different years. Currently the years are calculated from the server time.
Source code viewer
- // Set your desired timezone, if server default is not for you. Calculating years the error can be just a day before and after new year.
- // Get current year.
- // Or just as default time is "now"
- // Last year.
- // Next year.
- // 100 years from today.Programming Language: PHP