Welcome to Geeklog, Anonymous Monday, December 23 2024 @ 12:01 am EST

Geeklog Forums

Date And Time


Anonymous

Anonymous
This is probably something I should have figured out myself but im stuck. The date and time is wrong on my site and I cant find the where to configure it? I looked in the main config file and cant see mto see it, can anyone point me in its direction. Cheers Mike
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany

Depends on what you mean by "wrong" ...

If your clock is off, you need to set it on the machine your site is running on (or contact your hosting service and ask them to set it). If you just don't like the formatting of the date and time, this is explained in the documentation.

bye, Dirk

 Quote

Status: offline

jlhughes

Forum User
Full Member
Registered: 04/25/02
Posts: 154
The problem you are describing may be caused by the difference in timezones between where you are and where your server is.

This story explains a hack that will make the server report the timezone you set.

I have been using this on a couple of sites where I want local times displayed.

There may be a conflict between this hack and how Geeklog stores the times for story creation.

I have a site on which I have Pacific (California) time displayed. The site server is on Eastern (Florida) time. That's a 3-hour difference. While Geeklog displays Pacific time on the site, the story creation time stored in the database is off by an addition 3 hours. Essentially, the difference between West coast and East coast is being applied twice to the date and time stored for story creation. I haven't been able to figure this out yet.

 Quote

Anonymous

Anonymous
It's interesting that the Eastcosters are using West Cost servers, and vise-versa. Why don't we exchange? How much do you pay for it?
 Quote

Anonymous

Anonymous
I think I've figured out why this happens, but I haven't quite figured out how to fix it. The problem is that setting the TZ variable in the timezone hack affects how php converts between GMT and local, but it doesn't affect mySQL, which still uses the timezone of the server. For example, in my case, I'm in EDT and my server is in PDT. So I use the timezone hack to set the timezone to Eastern. Suppose I'm posting a story at 7:00 here .. that's 4:00 on the West Coast and 11:00 GMT. When I create the story, PHP gets the system time (11:00 GMT), looks at my timezone (EDT), subtracts 4 hours, displays 7:00 AM. I enter the story, PHP gives the local time (7:00 AM) to mySQL. mySQL converts the local time to a Unixtimestamp, using the timezone of the server where he's running (PDT). In other words, mySQL thinks the 7:00 is 7:00 PDT, so it adds 7 hours to get GMT instead of 4, and that's what gets stored in the database: 14:00 GMT instead of 11:00. Then when the story gets displayed, PHP knows I'm in EDT, so it subtracts 4 hours from the stored "GMT" time, and gets 10:00 I found <a href="http://www.geeklog.net/comment.php?mode=display&sid=20020201133144496&title=Hack+for+hack+to+shift+time+zone&type=article&order=&pid=1576"> this hack</a> which I haven't tried yet, but it sounds like it fixes the problem more completely. (In my case, I'd need to reverse it) The author says the only problem is that it doesn't display the correct time zone. Maybe what's necessary is some combination of the two, so that times get adjusted correctly when being stored in the database, and then not adjusted again when displayed.
 Quote

Status: offline

icode

Forum User
Newbie
Registered: 03/20/04
Posts: 12
Quote by jlhughes: The problem you are describing may be caused by the difference in timezones between where you are and where your server is.


This story explains a hack that will make the server report the timezone you set.





Where exactly is this story? Every time I click it I just go to the geek log home page?

 Quote

Status: offline

geKow

Forum User
Full Member
Registered: 01/12/03
Posts: 445
Search for "Timezone hack" Wink
It's here and it works. My site hosted in New York shows and stores stories in CET.

geKow
 Quote

Status: offline

icode

Forum User
Newbie
Registered: 03/20/04
Posts: 12
Quote by geKow: Search for "Timezone hack" Wink
It's here and it works. My site hosted in New York shows and stores stories in CET.

geKow



Nice... it worked. Thank You! Smile Smile
 Quote

All times are EST. The time is now 12:01 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content