You are not logged in.

#1 2017-06-06 12:42:11

bezik
Member
Registered: 2017-06-06
Posts: 3

Wrong date in browser

Hello! I've been using first Chromium, and then Google Chrome, but on both of these browsers i have a problem with date.
Both my hardware clock and system clock shows the same hour, but google chrome is 2 hours before them.

I've set up timezone using

timedatectl set-timezone Europe/Warsaw 

command.

This is output of timedatectl command

timedatectl           
      Local time: Tue 2017-06-06 14:37:48 CEST
  Universal time: Tue 2017-06-06 12:37:48 UTC
        RTC time: Tue 2017-06-06 12:37:48
       Time zone: Europe/Warsaw (CEST, +0200)
 Network time on: no
NTP synchronized: no
 RTC in local TZ: no

And this is the output new Date().toUTCString() on chrome

"Tue, 06 Jun 2017 12:41:04 GMT"

Any ideas what went wrong?

Last edited by bezik (2017-06-06 12:43:52)

Offline

#2 2017-06-06 12:52:12

Xyne
Forum Fellow
Registered: 2008-08-03
Posts: 6,965
Website

Re: Wrong date in browser

bezik wrote:

This is output of timedatectl command

timedatectl           
      Local time: Tue 2017-06-06 14:37:48 CEST
  Universal time: Tue 2017-06-06 12:37:48 UTC
        RTC time: Tue 2017-06-06 12:37:48
       Time zone: Europe/Warsaw (CEST, +0200)
 Network time on: no
NTP synchronized: no
 RTC in local TZ: no

And this is the output new Date().toUTCString() on chrome

"Tue, 06 Jun 2017 12:41:04 GMT"

Any ideas what went wrong?

Nothing went wrong. GMT = UTC. You are using toUTCString(), which will "Convert a Date object to a string, according to universal time". If you want local time, use one of the other methods such as toDateString().


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#3 2017-06-06 13:09:12

bezik
Member
Registered: 2017-06-06
Posts: 3

Re: Wrong date in browser

Sorry, i've hurried up. It's not only about this one function. When i get a message on facebook, slack or anything else like that the time is also shifted by -2 hours.

Offline

#4 2017-06-06 13:15:31

Xyne
Forum Fellow
Registered: 2008-08-03
Posts: 6,965
Website

Re: Wrong date in browser

bezik wrote:

Sorry, i've hurried up. It's not only about this one function. When i get a message on facebook, slack or anything else like that the time is also shifted by -2 hours.

Does toDateString report the correct time?
Can you post a link to a publicly accessible webpage that reports the wrong time?

Also, what is the output of

echo $TZ

My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#5 2017-06-06 13:22:23

bezik
Member
Registered: 2017-06-06
Posts: 3

Re: Wrong date in browser

Sorry for trouble, seems like it's all working correctly after i've set up timezone and restarted ntpd.service.

Offline

#6 2017-06-06 14:47:26

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: Wrong date in browser

Please remember to mark this thread as solved by editing the first ppost and adding [SOLVED] to the title. It lets other people, who may face a similar issue in the future, know that this thread has a possible solution. Thank you.


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#7 2022-07-14 10:17:55

ordinary.schreiber
Member
Registered: 2021-10-15
Posts: 146

Re: Wrong date in browser

Hello everyone, I just found this thread and I have the same issue.

Although, I couldn't understand exactly how to apply this feature to my system. What do I have to do exactly?

Thank you in advance.

Offline

#8 2022-07-14 12:09:05

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: Wrong date in browser

This thread is five years old. Please do not necrobump.

Closing.

Offline

Board footer

Powered by FluxBB