|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Chop Chop
|
Time Questions (PHP)
*Sigh*
I have been working on my website a lot lately and I have added somethings that have a timestamp on them (like a post in a forum). I want the members to be able to select which timezone they are in, and then have the script change the timestamp accordingly. So if I post at 3:00 PM (GMT -6) then in GMT -5 it would be 4:00 PM. How do take a date from a db and change it to the correct timezone depending on what the user has set? Also, how would I set Daylight Savings Time? Like in this forum, you can select if you want DST, on, off, or automatically changed. Any help would be much appreciated. |
|
|
|
|
|
#2 |
|
Staff
Premium Member
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
|
Be pretty easy to do. Just create a separate column in the database like time offset. You could then just subtract the value to give them their time.
DST would be more complicated. I would have to think on that one. You might download PHPBB and look at how they do some of their date calculations.
__________________
Want to Make $$$$ with your Computer? No Risk! Simply press shift-4 four times in a row |
|
|
|
|
|
#3 |
|
Chop Chop
|
I would have to set the time to GMT first, before I add/substract the offset, right? I will get PHPBB and see what they do. Thanks!
|
|
|
|
|
|
#4 |
|
Chop Chop
|
PHPBB confused me, oh well. I am having a problem with taking time from the database.
Very simply, here is what I am doing. PHP Code:
I am also still having trouble figuring out how to use DST. Any typos in the code aren't in the code I am using, I just wrote this up fast to show what I was doing. Thank you! Last edited by catacon; 08-17-2005 at 07:13 PM. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|