In this tutorial, i will show you php string date to date format. i explained simply step by step php date string to datetime object. i explained simply about php string date format conversion. you can see string date to date format in php. you will do the following things for convert string date to date format in php.
In this example i will give you very simple way to convert php string date to date formate. i gave you two example to understand how you will php string date format conversion. Also added output of that php example.
So, let's see both example. you can understand how it works.
Example:
<?php
$myStringDate = "1564079400";
date_default_timezone_set('Asia/Kolkata');
$newDateFormat = date('m/d/Y', $myStringDate);
print_r($newDateFormat);
?>
Output:
07/26/2019
Example 2:
<?php
$myStringDate = strtotime('26-07-2019');
$newDateFormat = date('m/d/Y',$myStringDate);
print_r($newDateFormat);
?>
Output:
07/26/2019
I hope it can help you...
Do you like below Tutorials ?
- Angular Use CKEditor Example Tutorial
- How to Use Multiple Select Dropdown in Laravel?
- Angular 9 Image Upload with Crop Example
- Files Upload on Button Click in PHP Dropzone Example
- PHP Dropzone Allow only One File to Upload Example
- PHP Dropzone Allow only Images to Upload Example
- PHP Dropzone Delete Uploaded File Example
- Livewire CRUD Laravel 7 Example