PHP date_format() function with example

Prem Tiwari - - PHP Tutorials


The date_format() function is a built-in function in PHP programming language. This funtion will return a new DateTime object and then format the date. In this post, I will share a PHP date_format() function with example.

Syntax:

Below is the Syntax of date_format() funtion in PHP code.

Example 1) strtotime() function

Outout:

2013/03/15 00:00:00

Example 2) Procedural style

2009-02-15

Example 3) Object oriented style

2009-02-15