How to change date format in PHP?

In this post, i would like to share with you how do i change date format DD/MM/YYYY to YYYY-MM-DD, MM-DD-YYYY to YYYY-MM-DD, d/m/Y to Y-m-d in PHP. we will convert date format using date() and strtotime() of PHP.

I will give you very simple example that helps you to simply change date formate in PHP. We most of need to change date format when you store date into database and when you display on list page. So i will give you bellow three example that will help you to easily convert date format in PHP.

So, let’s see three example, so you can use in your core PHP Application.

Convert yyyy-mm-dd to mm/dd/yyyy in PHP

In this example we will add “2019-08-15” with (YYYY-MM-DD) format and we will change into MM/DD/YYYY format in php.

$myOriginalDate = "2019-08-15";


$myNewDate = date("m/d/Y", strtotime($myOriginalDate));





Convert yyyy-mm-dd to dd-mm-yyyy in PHP

In this example we will add “2019-08-15” with (YYYY-MM-DD) format and we will change into DD-MM-YYYY format in php.

$myOriginalDate = "2019-08-15";


$myNewDate = date("d-m-Y", strtotime($myOriginalDate));





Convert dd/mm/yyyy to yyyy-mm-dd in PHP

In this example we will add “15/08/2019” with (DD/MM/YYYY) format and we will change into YYYY-MM-DD format in php.

$myOriginalDate = "15/08/2019";


$myOriginalDate = str_replace('/', '-', $myOriginalDate );

$myNewDate = date("Y-m-d", strtotime($myOriginalDate));





Now you can check anyone, it will help you.

I hope it can help you…

#php #web-development

What is GEEK

Buddha Community

How to change date format in PHP?

Hire PHP Developer

Looking to develop a PHP based website from scratch or revamp your existing website? has always been an industry leader for companies and business owners looking to hire PHP web developer. By choosing to Hire PHP Developer from our company, you can always expect the best results. Our PHP services and solutions are always flexible which means that no matter the nature of your project, you can always count on us for getting the best PHP expertise.

Consult with our experts:

#hire php developer #php developer #php development company #php development services #php development #php

Hire PHP Developer - Best PHP Web Frameworks for Web Development

A framework that can drastically cut down the requirement to write original code to develop the web apps as per your requirement is PHP Framework. PHP frameworks offer code libraries for commonly used functions to reduce the development time.

Want to use PHP Web Frameworks for your web applications?

WebClues Infotech offers a service to hire dedicated PHP developers for all of the below-mentioned frameworks

  • Laravel Developer
  • Codeigniter Developer
  • Yii Developer
  • Zend Developer
  • Cake PHP Developer
  • Core PHP Developer

Not sure which framework to use for your PHP web application?

Contact us

Schedule Interview with PHP Developer


#hire php developer #hire php web developers #hire php developer in 2021 #hire php developers & dedicated php programmers #hire php developers india #hire and outsource freelance php developers

Hire Dedicated PHP Developer

Looking to hire affordable yet experienced PHP developers?

Hire Dedicated PHP Developer, who can convert your idea to reality, within the stipulated time frame. expertise & experience as the top PHP development company put us above our competitors, in many ways. We have some of the top PHP developers in the industry, which can create anything you can imagine, that too, at the most competitive prices.

Consult with our experts:-

#hire dedicated php developer #php developers #php development company #php development services #php development #php developer

Mariya James

Mariya James


Top PHP web development company| PHP development services India

ValueCoders is a leading PHP app development company that focuses on building robust, secure & scalable web applications for start-ups, enterprises, and entrepreneurs.

We have 16+ years of experience and have delivered custom PHP web development solutions to 2500+ global clients catering industry verticals, including healthcare, adtech, eLearning, data analysis, Fintech, eCommerce, etc

Are you planning to outsource PHP development services? Or want to hire an offshore PHP development team?

#hire php developer #hire a php developer in india #hire dedicated php programmers #hire php coders #php developer in india #php developers for hire

Custom PHP Development Company | PHP Web Development Service

One programming language that has its root in Website development even at present is PHP Website Development. The PHP programming is executed on the server side which means it functions on web servers which helps the website in its performance.

Want to develop a website on PHP?

WebClues Infotech with its years of experience in Web Development helps individuals and businesses in launching a business website on PHP. The experienced development team with more than 20 years of experience is the solution to your every web development needs.

Want to know more about PHP website development?


Share your requirements

View Portfolio

#custom php development company #php web development service #php development services #php web development company india #php development services #hire php developers