IPB

Welcome Guest ( Log In | Register )



Tags
This content has not been tagged yet
 
Reply to this topicStart new topic

Php Time! Help!


arcticsnpr
no avatar
Newbie [Level 2]
**
Group: Members
Posts: 27
Joined: 5-April 06
Member No.: 21,363



Post #1 post Nov 1 2006, 09:02 PM
hey, i know the issue of time and date with php and just been posted. But honestly, i didn't get the answer i neeed. I'm building a user personalization website, and i need help with the time. It all get messed up because the server is in a diiferent time zone. Should i use gmdate() function? because i'm using date().

All that said, whats the best way to use time and dates for like a forum in php?
Go to the top of the page
+Quote Post
jlhaslip
no avatar
A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon
Group: [MODERATOR]
Posts: 4,336
Joined: 24-July 05
From: Linix, DOS and Windows…the good, the bad and the ugly
Member No.: 9,787
Spam Patrol
myCENT:10.0



Post #2 post Nov 1 2006, 09:22 PM
Using gmdate() makes the script more portable since all the adjustments are then made against GMT time, so go with that if you plan on making it work on several other servers or if the Server changes time zones.

Each user's time adjustment would then be an offset from GMT rather than the Server's Local time.
Either way, an adjustment would be required unless they were in the correct zone.
Go to the top of the page
+Quote Post
midnitesun
no avatar
Premium Member
********
Group: Members
Posts: 181
Joined: 22-February 06
Member No.: 19,007



Post #3 post Nov 2 2006, 11:36 AM
as jihaslip has said using gmdate() is always the best opition which then can be adjusted by the user in accordance to his time zone , for which you just have to include a little extra code if you don not have one already
Go to the top of the page
+Quote Post
electron
no avatar
Premium Member
********
Group: Members
Posts: 162
Joined: 10-May 06
Member No.: 23,375
myCENT:NEGATIVE[-4.47]



Post #4 post Nov 2 2006, 02:39 PM
Well then what to do if we are to store the GMT time in the database. According to the IST(Indian Standard Time-I live in India) we are 5 and a half hours ahead of GMT.
I tried using gmmktime() function and it returns me the time + 5 and a half hours ahead of IST instead of 5 and a half hours behind IST.

So just one suggestion use time() store it in the database and then use gmdate to get the GMT time. But this thing has a disadvantage you know. Whenever you change the server to a different one the time settings being different the GMT time and the time itself would be going wrong.
Go to the top of the page
+Quote Post
arcticsnpr
no avatar
Newbie [Level 2]
**
Group: Members
Posts: 27
Joined: 5-April 06
Member No.: 21,363



Post #5 post Nov 2 2006, 08:32 PM
ok thanks so much for your help guys! much appreciated biggrin.gif
Go to the top of the page
+Quote Post
cnetboss
no avatar
Newbie [Level 2]
**
Group: Members
Posts: 28
Joined: 6-November 06
Member No.: 32,893



Post #6 post Nov 6 2006, 11:08 PM
thanks guys, I also have some issue about the date() function because I want to match my date and time in my area (I'm in GMT+8 area)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   11 campainer 1,646 14th August 2004 - 03:33 AM
Last post by: SilverBoarder
No New Posts 1 NuHoaXuLa 516 27th August 2004 - 05:43 PM
Last post by: odomike
No New Posts 0 synderoxide 660 8th September 2004 - 04:53 AM
Last post by: synderoxide
No New Posts 0 pasten 326 6th January 2008 - 06:53 AM
Last post by: nitish
No New Posts 5 hulunes 570 20th October 2004 - 02:39 PM
Last post by: melkonianarg
No new 133 Saint_Michael 10,614 1st June 2008 - 12:23 AM
Last post by: HyBriD54
No New Posts   1 Editor 236 14th October 2004 - 09:11 PM
Last post by: wassie
No New Posts   4 DMA 365 29th October 2004 - 07:50 PM
Last post by: odomike
No New Posts   6 Moneymaker 290 14th November 2004 - 08:59 AM
Last post by: googlue
No New Posts 7 delivi 288 1st July 2006 - 10:09 PM
Last post by: delivi
No new   154 rovertos 9,453 2nd October 2008 - 08:59 PM
Last post by: iGuest-Moonfrost
No new   45 rovertos 3,267 7th May 2005 - 03:59 PM
Last post by: MechVegita
No New Posts   7 cragllo 933 2nd September 2006 - 10:16 AM
Last post by: masterio
No New Posts   2 Vera 403 20th January 2008 - 02:19 PM
Last post by: salamangkero
No New Posts   6 Vigorous 621 18th December 2004 - 04:36 PM
Last post by: Vigorous


 



RSS Lo-Fi Version Time is now: 5th December 2008 - 07:53 AM