The Date is an inbuilt function used to format the timestamp. The computer stores date and time in UNIX Timestamp. This time is measured as a number of seconds since Jan 1, 1970. Since this is impractical for humans khổng lồ read, PHP. converts timestamp khổng lồ a format that is readable & more understandable lớn humans.Syntax:date( format, timestamp )Explanation:The format parameter in the date() function specifies the format of returned date & time.The timestamp is an optional parameter. If it is not included then the current date và time will be used.In order to lớn get the current year as four digits, Y is used as a parameter khổng lồ date() function as shown in the below:Program:
Bạn đang xem: How do i use php to get the current year?Format options available in date() function: The format parameter of the date() function is a string that can contain multiple characters allowing lớn generate dates in various formats are listed below:d – Represents the day of the month. It uses two digits with leading zeros (01 or 31).D – Represents day of the week in the text (Mon lớn Sun).m – Represents month in numbers with leading zeros (01 or 12).M – Represents month in text, abbreviated (Jan lớn Dec).y – Represents year in two digits (08 or 14).Y – Represents year in four digits (2008 or 2014).PHPhường. is a server-side scripting language designed specifically for website development. You can learn PHP.. from the ground up by following this PHPhường. Tutorial and PHPhường. Examples.
How khổng lồ execute PHP. code using command line ?How to lớn Upload Image into lớn Database & Display it using PHP ?Comparing two dates in PHPHow khổng lồ Insert Form Data inlớn Database using PHPhường ?Download tệp tin from URL using PHP
How khổng lồ execute PHPhường. code using comm& line ?How to Upload Image into Database & Display it using PHP ?Comparing two dates in PHPHow to Insert Form Data inkhổng lồ Database using PHPhường ?How to gọi PHP.. function on the cliông xã of a Button ?