CDR Timezone and PHP

Ok, I see a field in Advanced Settings PHP timezone. Is this the area to change? If so, it did not take effect when I restarted Asterisk. Do I need to restart Apache also?

ALSO, is there any way to leave the system in local time and just force CDR records to UTC?

There was a way I believe in previous releases where a variable usegmtime could be set in cdr.conf and/or cdr_obdc.conf

I took a quick look at the source code for cdr_obdc.c and it looks like that code is still in there…

Asterisk doesn’t use the PHP timezone.

As discussed in IRC use the uniqueid field.

$date = new DateTime("@1491412157.0"); //Wednesday April 05, 2017 17:09:17
$date->setTimezone(new DateTimeZone('America/Phoenix')); //Wednesday April 05, 2017 10:09:17

There is another timezone field in Admin/System Admin/Timezone, but I’m guessing that will alter the timezone for the entire system? It does say the system needs to be rebooted for that change to take effect.

Yes, I have created the code in PHP to adjust the timezone, but not sure this will work when we have daylight savings time changes. Not clear about PHP accounting for that automatically?

Finally, what about that usegmtime setting in the cdr_obdc.conf file. It would appear that was designed to do exactly what I’d like, but there’s no mention if that still works or not.

Thanks

you can also add this to cdr_adaptive_odbc.conf:

usegmtime=yes

OK, that’s what I was looking for. usegmtime=yes in cdr_adaptive_obdc.conf. I was looking in cdr_obdc.conf.

That will limit the TZ change to CDR rows and not the rest of the system settings, correct?

Need system reboot or just Asterisk reload?

Just reload:

fwconsole r

igetz,

Perfect solution

Thanks

1 Like

This will most likely break on freepbx 14

it looks like web GUI uses php time because when i corrected it, the old records in CDR started to show correct time i.e UTC+5.