Get current IST time in php

Get exact Current Indian Time in PHP

$date = date_default_timezone_set('Asia/Kolkata');

//If you want Day,Date with time AM/PM
echo $today = date("F j, Y, g:i a T");

//Get Only Current Time 00:00 AM / PM 
echo $today = date("g:i a");

To get the user current time you will need javascript. if you want to make default timezone on your pages you can use date_default_timezone_set

You can read about this in: HERE


Set your system time correctly, so your system knows its correct timezone and the correct time there. In PHP, set your desired timezone, then just print the date:

date_default_timezone_set('Asia/Kolkata');
echo date('d-m-Y H:i');

Don't do manual offset calculations unless you know exactly what you're doing, it's way too fickle.


Use now() method it gave current time.

$query = "UPDATE (table name) SET (column) = now() WHERE (condition)";

Note: Make sure that type of the column in the database must be DATETIME type.

Tags:

Php