Get the Current Date and Time using PHP

Get the Current Date & Time of India using PHP

Here you will learn how to get the current date and time of India or any country using PHP.

Get the current date and time of a specific country

To get the current date and time of a specific country, you need to set the time zone of that country as the default time zone.

For example, if you want to know the current time of India, first you have to set the India’s time zone which is “Asia/Kolkata”.

Set the default time zone with the help of the PHP date_default_timezone_set() function.

<?php
// Asia/Kolkata is for INDIA
date_default_timezone_set('Asia/Kolkata');
<?php
date_default_timezone_set('Asia/Kolkata');

$date = date('d-m-Y');
$time = date("h:i:s");

echo $date;
echo $time;

List of all the Time Zones

AfricaAmericaAntarcticaArctic
AsiaAtlanticAustraliaEurope
IndianPacificOthers