How to get the local date and time in PHP.For example my timezone is Asia/Kolkata. My application has to add the date in my time zone to the database.I know the time can be found by adding 5.30 hrs to UTC time.But what about the date.After some googling I found that there is a DateTime object and it has a function setTimezone() to set the time zone.But after setting how can i get the current date in my time zone.?
You should rather use "date_default_timezone_set()" functions, once it is set, all the date time function will treat it as local timezone. I believe, you can also set it using php.ini
http://pk1.php.net/manual/en/function.date-default-timezone-set.php