Hi I am trying a piece of code wherein I need the exact time.
<?php
date_default_timezone_set('Asia/Kolkata');
echo date("y:d:m:H:i:s");
?>
It shows as the o/p 12:11:04:12:31:24 which is almost 2:30 hours behind the exact time. I am in Mumbai and i want the exact current time. Any suggestions?
As RayMoonDay stated above:
I have not tested it – I am just putting it in answer form. If RayMoonDay posts this as an answer, I will edit this to remove that information.
However, I feel compelled to advise you against using
date()and familiarize yourself with theDateTimeclass.date()may be fine for your application. but it has some known issues, especially with future dates.DateTime: http://php.net/manual/en/class.datetime.php