how to get current date and time in php
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.
php get current date and time
Here in this example, we will print the current date and time using the php. so you can see below example.
1 2 | $current_date = date("d-m-y h:i:s"); echo $current_date; |
get current date and time with timezone
We will get the current date and time according to the timezone. so you can see the below example.
1 2 3 | date_default_timezone_set('America/New_York'); $current_date = date('d-m-y h:i:s') ; echo $current_date; |
change current date format in php
we can easily change the date formate in php. so you can see the below example.
1 2 | $current_date = date("d/m/y h:i:s"); echo $current_date; |
Please follow and like us: