CDR Timezone and PHP


(Jim C) #1

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…


Changing timezone from UTC?
(TheJames) #2

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

(Jim C) #3

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


(Lorne Gaetz) #4

you can also add this to cdr_adaptive_odbc.conf:

usegmtime=yes

(Jim C) #5

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?


(Lorne Gaetz) #6

Just reload:

fwconsole r

(Jim C) #7

igetz,

Perfect solution

Thanks


(Andrew Nagy) #8

This will most likely break on freepbx 14


(Jameel) #9

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.