I'm trying to converting local date time to UTC time but it's not converting. i'm using this:-
$check= 13-07-2015 12:03:41;
$userdate=gmdate("Y-m-d H:i:s", strtotime($check));
Its giving me only 2 hours difference between my local time to UTC time but actual difference is 5:30 hours. Please suggest me how to convert this.
$check
needs to be a string (I'll assume it is and you just forgot to add the quotes in the edit)
$check = '13-07-2015 12:03:41';
find out what timezone your php thinks you're in:
echo date_default_timezone_get();
if it's not your timezone (it should be something like 'Asia/Kolkata' from the 5 1/2 hrs difference) then update your timezone
in your php.ini
file with the correct one
if you can't access your php.ini
file then you'll need to set the timezone in your script using date_default_timezone_set