In this tutorial, we will explain to you how to get current date and time in php. we can easily get the current date in php.
Here in this example, we will print the current date and time using the php. so you can see below example.
$current_date = date("d-m-y h:i:s");
echo $current_date;
We will get the current date and time according to the timezone. so you can see the below example.
date_default_timezone_set('America/New_York');
$current_date = date('d-m-y h:i:s') ;
echo $current_date;
we can easily change the date formate in php. so you can see the below example.
$current_date = date("d/m/y h:i:s");
echo $current_date;