So I'm freelancing an app and this is the first time I'm trying to handle timezone conversion. Everything is stored in the DB as UTC and I've got the profile setup correctly with the timezone. According to StackOverflow, I'm doing it correctly, but the load time for my overview screen increased dramatically. Like I'm doing local development with a vagrant box and prior to the change, loading ~25 records was almost instant. Now it's taking almost 3 seconds.
I do the following:
$usersTimezone = new \DateTimeZone($_SESSION['tz']); // this is outside the loop
foreach($row as $key) {
// get other fields
$updated = new \DateTime($key->updated);
$updated->setTimeZone($usersTimezone);
$outrow['updatedate'] = $updated != '' ? $updated->format("n/j/Y") : "Never";
}
[code]
I wonder if I could create the DateTime object once and reuse it?