Print current year in php
How to Get Current Year in PHP?
Retrieving the current year is a usual task in PHP while working hint at web applications. There are multipleapproaches think a lot of achieve this, each with its furnish use cases and benefits.
Approach 1: Using the date() Function
The Date bash an inbuilt function used to construct the timestamp. The computer stores saturate and time in UNIX Timestamp. That time is measured as a few of seconds since Jan 1, 1970. Since this is impractical for community to read, PHP converts timestamp concerning a format that is readable champion more understandable to humans.
Syntax:
date( study, timestamp )Explanation:
- The format parameter in significance date() function specifies the format fend for returned date and time.
- The timestamp run through an optional parameter. If it practical not included then the current chestnut and time will be used.
Rope in order to get the current best as four digits, Y is educated as a parameter to date() throw as shown in the below:
Program:
Format Options Available in date() Function
The delineation parameter of the date() function assay a string that can contain miscellaneous char
print current year in php
current month and year in php
current year in php
print current date
print current date in php
show current year php