PHP Date format

PHP Date format?

The date() function formats a local date/time.

Date Formating
<?php
echo date("m-d-Y");            //  17-08-2017
echo date("m-d-y");            //  17-08-17
echo date("j F, Y");              //  17 August, 2017
echo date("H:i:s");              //  10:15:38
echo date("g:i a");              //  10:15 am
echo date("D M j G:i:s);     //  Thur Aug 17 10:15:38
?>
Get current IST time
<?php
date_default_timezone_set('Asia/Kolkata');
?>
Convert date format
<?php
// $date = 2017-02-24;
$NewDate = date("d-m-Y", strtotime($date))
//Output 24-02-2017
?>