Hope all are feeling okay. Today in this post I will show you how to convert string date to date format. Whenever many of times we need to convert string date to datetime as like m/d/Y, Y-m-d, d-m-Y etc in php application. We can easily convert from string date to specific date formate in php application. Now We can do by use date() for converting string date to format. We can also do same by set timezone. Before convert a string date to date in php application.
In this post i will give you very shortly and simple way to convert a php string date to a date formation. I will give you best two examples to understand how we will do a php string date format conversion. So also added output of that php application.
Read Also : How to Include Blade File with Data in Laravel?
So, let’s start and see both of examples. You can understand how it works.
<?php $myStringDate = "1564079400"; date_default_timezone_set('Asia/Dhaka'); $newDateFormat = date('m/d/Y', $myStringDate); print_r($newDateFormat); ?>
Read Also: How to Install Vue JS in Laravel 8 ?
<?php $myStringDate = strtotime('26-07-2019'); $newDateFormat = date('m/d/Y',$myStringDate); print_r($newDateFormat); ?>
Thanks for read this, I hope it will you. You can also follow us on Facebook.