I'm trying to change the format of the date pulled from Parse in a custom column. I tried:
$query = new ParseQuery("ClassName");
$results = $query->find();
for ($i = 0; $i < count($results); $i++) {
$object = $results[$i];
$date = $object->get("customDateColumn");
echo $date;
}
It echos the Parse Default timezone which is UTC. How can i convert it to GMT+8? I tried adding date_timezone_set('Etc/GMT+8')
But it doesn't do anything. Hope you guys can help me. Thanks!
It looks that the $date variable are not a Date Object. You can only use the timezone function with Date objects. But that not help you the Timezone function do not convert your time object it only define the default timezone for the time() function.
Well, buddy If you know in what timezone that date has been generated and if the date is coming from a DB, probably you can query a date with the original TimeZone.
$date = new DateTime( "2015-12-03 15:00:00", 'Actual TimeZone which generated this date' );
$date->setTimezone( "GMT + 8 timezone here" );
echo $date->format('Y-m-d H:i:s');