Get Current Indian Time In PHP
This tutorial is about how to get current Indian time in PHP. There so many options on how to do display the Current Time and date in India.
Code to Get Current Indian time in PHP
To begin with, you open a text editor you like. In my case I use SublimeText. Then, create a PHP file. Finally, add the following code and save.
$Date = date_default_timezone_set('Asia/Kolkata');
echo "<h3>Your Timezone is Asia/Kolkata</h3>";
//If you want Day,Date with time AM/PM
echo $datetoday = "<b>Date Today: </b>". date("F j, Y, g:i a T") ."</br>";
//To the Current Time 00:00 AM / PM
echo $datetoday ="<b>Time Today:</b> ". date("g:i a");
How to test the PHP code?
To test the PHP code, you have to open a browser. Then, type the “Localhost/currenttime.php” and press enter. After this step, you will be able to see the result just like as shown in the image below.
If you have any questions about this topic, please let us know maybe we can help.