Web based family history software

This Help forum is for issues relates to the latest release (1.7.9). For issues related to beta or github version please use their own Help forum.
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
  • New Member
  • GNMPD-Editor (PHP ver 8.1.5)
More
7 years 2 months ago #1 by badmoonrising
Website preferences - Time zone was created by badmoonrising
We went into (Control Panel-Website Preferences-time zone), and selected "Denver USA" so that our tree would perform and show our time to all who use it. After doing this we noticed that it did not change, and that we are still in the default (UTC) time. Yet, it shows Denver USA in the time zone.

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.

More
7 years 2 months ago #2 by fisharebest
Replied by fisharebest on topic Website preferences - Time zone
The server timezone is used for visitors to the site.
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.

More
7 years 2 months ago #3 by mp
Replied by mp on topic Website preferences - Time zone
I had and have timezone problems too. Look at my screenshot here: github.com/fisharebest/webtrees/issues/1120 .

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.

More
7 years 2 months ago #4 by fisharebest
Replied by fisharebest on topic Website preferences - Time zone
Times are displayed in many places.

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.

More
7 years 2 months ago - 7 years 2 months ago #5 by mp
Replied by mp on topic Website preferences - Time zone
No, I have logged-in few minutes ago: Timestamp is 2017-01-19 07:26:03. But in Germany it is 8:26.

Server information/ PHP variables
$_ENV 1484810927.0428
$_ENV 1484810927

Martin - ffp.bauschaffen.de
Last edit: 7 years 2 months ago by mp.

Please Log in or Create an account to join the conversation.

More
7 years 2 months ago #6 by fisharebest
Replied by fisharebest on topic Website preferences - Time zone
There is a difference between a timestamp (an exact point in time when something happened), and a date-time.

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.

More
7 years 2 months ago #7 by mp
Replied by mp on topic Website preferences - Time zone
> The server information page will show timezone settings for both PHP and MySQL. What values do you have for these?

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.

More
7 years 2 months ago - 7 years 2 months ago #8 by fisharebest
Replied by fisharebest on topic Website preferences - Time zone
If we make a change in webtrees, we can record the timestamp. We can therefore convert the timezone.

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
Last edit: 7 years 2 months ago by fisharebest.

Please Log in or Create an account to join the conversation.

More
7 years 2 months ago - 7 years 2 months ago #9 by mp
Replied by mp on topic Website preferences - Time zone
First I use webtrees as the only program for genealogical research. I do not edit anything outside.

> 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
Attachments:
Last edit: 7 years 2 months ago by mp.

Please Log in or Create an account to join the conversation.

  • badmoonrising
  • Topic Author
  • Offline
  • New Member
  • New Member
  • GNMPD-Editor (PHP ver 8.1.5)
More
7 years 2 months ago #10 by badmoonrising
Replied by badmoonrising on topic [SOLVED] Website preferences - Time zone
Problem solved.

Please Log in or Create an account to join the conversation.

More
7 years 2 months ago #11 by mp

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
  • New Member
  • GNMPD-Editor (PHP ver 8.1.5)
More
7 years 2 months ago #12 by badmoonrising
Replied by badmoonrising on topic [SOLVED] Website preferences - Time zone
Our issue is not actually solved, but nothing can be done in web-trees. We are going to check with our server to see if the time zone can be changed at their end as indicated in a response.

Please Log in or Create an account to join the conversation.

More
7 years 2 months ago #13 by fisharebest
Replied by fisharebest on topic [SOLVED] Website preferences - Time zone
We set the PHP timezone according to your preferences in your account details. Here is the code:
Code:
date_default_timezone_set(Auth::user()->getPreference('TIMEZONE', 'UTC'));

We set the CHAN/DATE/TIME using the PHP. Here is the code:
Code:
$gedcom .= "\n1 CHAN\n2 DATE " . date('d M Y') . "\n3 TIME " . date('H:i:s') . "\n2 _WT_USER " . Auth::user()->getUserName();

To illustrate how this works, and to test it, here is an interactive PHP session:
Code:
php > date_default_timezone_set('UTC'); php > echo date('d M Y H:i:s'), PHP_EOL; 23 Jan 2017 13:55:51 php > date_default_timezone_set('Europe/Berlin'); php > echo date('d M Y H:i:s'), PHP_EOL; 23 Jan 2017 14:55:57

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.

More
7 years 2 months ago #14 by fisharebest
Replied by fisharebest on topic [SOLVED] Website preferences - Time zone
Guess: You had not set a timezone preference in your user account. Therefore webtrees assumes you are in UTC.

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

More
7 years 2 months ago - 7 years 2 months ago #15 by mp

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
Attachments:
Last edit: 7 years 2 months ago by mp.

Please Log in or Create an account to join the conversation.

More
7 years 2 months ago #16 by fisharebest
Replied by fisharebest on topic [SOLVED] Website preferences - Time zone
> Why the changes log and the recent changes bloc show another time (UTC)?

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,
Code:
mysql> SET time_zone = '+00:00'; Query OK, 0 rows affected (0.00 sec) mysql> SELECT NOW(); +---------------------+ | NOW() | +---------------------+ | 2017-01-23 15:25:45 | +---------------------+ 1 row in set (0.05 sec) mysql> SET time_zone = '+01:00'; Query OK, 0 rows affected (0.00 sec) mysql> SELECT NOW(); +---------------------+ | NOW() | +---------------------+ | 2017-01-23 16:25:51 | +---------------------+ 1 row in set (0.00 sec)

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:
Code:
self::$pdo->prepare("SET time_zone = :time_zone")->execute(['time_zone' => date('P')]);

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.

More
7 years 2 months ago #17 by mp
You are certainly right.

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.

More
7 years 2 months ago - 7 years 2 months ago #18 by fisharebest
Replied by fisharebest on topic [SOLVED] Website preferences - Time zone
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?

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net
Last edit: 7 years 2 months ago by fisharebest.

Please Log in or Create an account to join the conversation.

More
7 years 2 months ago #19 by wsb56
Replied by wsb56 on topic [SOLVED] Website preferences - Time zone

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.

More
7 years 2 months ago #20 by mp

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.

Powered by Kunena Forum
}