Before asking for help please read "How to request help" by clicking on that tab above here."
Question [SOLVED] Website preferences - Time zone
- badmoonrising
- Topic Author
- Offline
- New Member
- GNMPD-Editor (PHP ver 8.1.5)
I would like to know why it did not change; can it be changed; and if so what do we need to do?
Please Log in or Create an account to join the conversation.
- fisharebest
- Offline
- Administrator
Each user can also set their own timezone, which is used when they log in.
If you are logged in, the server timezone is therefore ignored.
Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net
Please Log in or Create an account to join the conversation.
- mp
- Offline
- Senior Member
I have set 'Europe/Berlin' and my server is situated in Germany. But there is a difference at the displayed time.
Martin - ffp.bauschaffen.de
Please Log in or Create an account to join the conversation.
- fisharebest
- Offline
- Administrator
Are they all the same?
For example, the logs in the control panel?
Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net
Please Log in or Create an account to join the conversation.
- mp
- Offline
- Senior Member
Server information/ PHP variables
$_ENV 1484810927.0428
$_ENV 1484810927
Martin - ffp.bauschaffen.de
Please Log in or Create an account to join the conversation.
- fisharebest
- Offline
- Administrator
Timestamps are stored as the number of seconds since 01-JAN-1970 00:00 (UTC).
We can convert timestamps.
Datetimes are stored as a textual description. For example, "2016-DEC-21/01:23"
We cannot convert datetimes, as they have no timezone information.
1) Genealogy data in GEDCOM is stored as a date-time.
Even if we could convert it, we should not.
For example, if we record that someone was born "DATE 21 DEC 2016 / TIME 01:23" in Europe, then this was actually on 20 DEC 2016 in America.
We should not change the date of birth for American visitors!
2) Events recorded by webtrees (emails, access logs, etc.) are stored as timestamps.
We can (and do) convert these. BUT, this relies on correct time-zone configuration of the server.
> Server information/ PHP variables
> $_ENV 1484810927.0428
> $_ENV 1484810927
This is the timestamp when the page request was made.
The server information page will show timezone settings for both PHP and MySQL. What values do you have for these?
Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net
Please Log in or Create an account to join the conversation.
- mp
- Offline
- Senior Member
MySQL
time_format
%H:%i:%s
time_zone
+00:00
timed_mutexes
OFF
timestamp
1484818610.520107
date
date/time support enabled
"Olson" Timezone Database Version 2016.9
Timezone Database internal
Default timezone Europe/Berlin
Directive Local Value Master Value
date.default_latitude 31.7667 31.7667
date.default_longitude 35.2333 35.2333
date.sunrise_zenith 90.583333 90.583333
date.sunset_zenith 90.583333 90.583333
date.timezone UTC
1) I understand this and it is not the problem.
The issue is the displayed change date on different places in webtrees (screenshot).
Martin - ffp.bauschaffen.de
Please Log in or Create an account to join the conversation.
- fisharebest
- Offline
- Administrator
For the recent changes block, we have a choice.
1) use the timestamp showing when the change was made. (The timestamp is saved in the pending changes table).
2) use the datetime from the CHAN record. (We use the genealogy records)
We can convert the first, but not the second.
BUT, if we use the first, we can only show changes made in webtrees.
Also, the timestamp will be different to the datetime. This will cause confusion.
If you edit your data in a desktop program, and use webtrees for display, there will be no changes in webtrees to display.
What if you edit a record, but tell webtrees to keep the existing CHAN record? Do you use the actual time of the change, or the value in CHAN/DATE/TIME?
If I remember correctly, webtrees uses (2), and therefore cannot convert timezones.
Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net
Please Log in or Create an account to join the conversation.
- mp
- Offline
- Senior Member
> What if you edit a record, but tell webtrees to keep the existing CHAN record? Do you use the actual time of the change, or the value in CHAN/DATE/TIME?
No, webtres should use the CHAN.DATE.TIME! Therefore I I have set 'Keep the existing “last change” information'.
Look at the attached screenshot. I made a change at 21:18 CET but the changes log timestamp is 20:18. This is UTC. Why? I installed webtrees on a german server with german time settings and have set webtrees to 'Europe/Berlin'. The recent changes bloc does not use the CHAN.DATE.TIME.
But at least, this behaviour is strange but not essential for work with webtrees.
Martin - ffp.bauschaffen.de
Please Log in or Create an account to join the conversation.
- badmoonrising
- Topic Author
- Offline
- New Member
- GNMPD-Editor (PHP ver 8.1.5)
Please Log in or Create an account to join the conversation.
- mp
- Offline
- Senior Member
Problem solved.
Great. But what was your solution? It seems that my problem was completely different ...
Martin - ffp.bauschaffen.de
Please Log in or Create an account to join the conversation.
- badmoonrising
- Topic Author
- Offline
- New Member
- GNMPD-Editor (PHP ver 8.1.5)
Please Log in or Create an account to join the conversation.
- fisharebest
- Offline
- Administrator
We set the CHAN/DATE/TIME using the PHP. Here is the code:
To illustrate how this works, and to test it, here is an interactive PHP session:
These are the current correct times for UTC and Berlin.
The code is pretty simple.
What happens if you change the timezone in your account to something like Europe/Moscow?
Do you see any change?
Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net
Please Log in or Create an account to join the conversation.
- fisharebest
- Offline
- Administrator
Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net
Please Log in or Create an account to join the conversation.
- mp
- Offline
- Senior Member
Guess: You had not set a timezone preference in your user account. Therefore webtrees assumes you are in UTC.
My user account is set to 'Europe/Berlin'. The change of timezone I will check this evening.
Otherwise I took a look to my webtrees database via phpmyadmin and found the right times (21:18:15 CET) for the change shown on the screenshot above:
db table 'log'
db table 'changes'
Why the changes log and the recent changes bloc show another time (UTC)?
Martin - ffp.bauschaffen.de
Please Log in or Create an account to join the conversation.
- fisharebest
- Offline
- Administrator
These timestamps are created by MySQL. (The columns have the property "DEFAULT CURRENT_TIMESTAMP").
MySQL will display timestamps according to the selected time. For example,
I guess that (a) phpmyadmin does not specify a time-zone, and (b) the MySQL database is running in UTC...
webtrees tells MySQL to use the same timezone as PHP. Here is the command we use:
So, the timestamp of the changes log that you see in PhpMyAdmin should be different to the timestamp you see in the webtrees control panel.
Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net
Please Log in or Create an account to join the conversation.
- mp
- Offline
- Senior Member
My "problem" is that I made f.i. a change at 21:18:15 CET, CHAN.DATE.TIME displays it correct (inside webtrees and in the database) and the database saves it right (wt_log, wt_changes). Only the changes log and the recent changes bloc in webtrees displays it wrong (exactly one hour less than CET). All my webtrees timezone settings (website, user account) are 'Europe/Berlin'.
Is there anyone who has similar deviations? Am I the only one with this issue? (Was sagen da die deutschen Nutzer? Zeigt der Block 'Aktuelle Änderungen' die richtige Änderungszeit?)
Martin - ffp.bauschaffen.de
Please Log in or Create an account to join the conversation.
- fisharebest
- Offline
- Administrator
SHOW VARIABLES LIKE '%time_zone%';
SELECT NOW();
edit - and is the output from the second query correct?
Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net
Please Log in or Create an account to join the conversation.
- wsb56
- Offline
- New Member
- Posts: 59
mp wrote: You are certainly right.
Is there anyone who has similar deviations? Am I the only one with this issue? (Was sagen da die deutschen Nutzer? Zeigt der Block 'Aktuelle Änderungen' die richtige Änderungszeit?)
Same problem on my installation.
Bernd
Please Log in or Create an account to join the conversation.
- mp
- Offline
- Senior Member
In PhpMyAdmin, what do you get from these queries
SHOW VARIABLES LIKE '%time_zone%';
SELECT NOW();
edit - and is the output from the second query correct?
Variable_name | Value
system_time_zone | CET
time_zone | SYSTEM
NOW()
2017-01-23 19:27:25
Yes, this time is correct for Germany at this moment.
Martin - ffp.bauschaffen.de
Please Log in or Create an account to join the conversation.