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.
<?php $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.
Anyway, if you want to study further about the date in PHP. You visit this tutorial about Unix Timestamp using PHP.
If you have any questions about this topic, please let us know maybe we can help.