Bugs should be reported on the Bug Tracker. To download the latest bleeding-edge version of the SDK, head over the SVN repository.
![]() ![]() |
|
Date/Time from SDK, Not sure what to fix here.
|
Nov 3 2003, 06:25 AM
Post
#1
|
|
|
Newbie ![]() Group: Members Posts: 82 Joined: 21-October 03 Member No.: 56,737 IPB Version: Not Applicable |
I'm not sure what to do with this, but when I use some function to draw out the time stamp and output into a date form using the SDK funtions... well it ends up with the wrong Time.
Say I posted at 7pm, the time pulled out would be 8am? I guess the board settings aren't effecting this one... -------------------- |
|
|
|
Nov 3 2003, 07:51 AM
Post
#2
|
|
![]() recursion n. see recursion ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 2,673 Joined: 11-April 03 From: 127.0.0.1 :) Member No.: 855 IPB Version: 1.3.x |
Hmm, the board offset and stuff don't affect it
As a temp fix try something like $time = $time + ($ibforums->vars['clock_offset'] * 60); I'm not quite sure if clock_offset is correct though Cow -------------------- |
|
|
|
Nov 3 2003, 08:15 AM
Post
#3
|
|
|
Newbie ![]() Group: Members Posts: 82 Joined: 21-October 03 Member No.: 56,737 IPB Version: Not Applicable |
I'll hold off what I'm doing for now... need sleep
-------------------- |
|
|
|
Nov 3 2003, 12:21 PM
Post
#4
|
|
![]() recursion n. see recursion ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 2,673 Joined: 11-April 03 From: 127.0.0.1 :) Member No.: 855 IPB Version: 1.3.x |
I just had a look into it, and I think it'd be almost too much work, and may cause problems to automatically offset everything before returned.
However, I have written a function which will do this offsetting, further more this can probably be combined with the date(), so instead of doing date("M j Y, h:i A", $date) just do generatedate("M j Y, h:i A", $date) to offset and show the date. Cow -------------------- |
|
|
|
Nov 3 2003, 05:29 PM
Post
#5
|
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 401 Joined: 10-April 03 From: O_Oing Posts Member No.: 304 IPB Version: 1.3.x |
Here's an idea... I've yet to test it, but it's an idea... I used the 'last_visit' variable...
CODE date ("M j Y, h:i A", mktime (date("H", $info['last_visit'])+$info['time_offset']+8,date("i", $info['last_visit']),date("s", $info['last_visit']),date("m", $info['last_visit']),date("d", $info['last_visit']),date("Y", $info['last_visit']),-1)); ...the +8 is there because my server uses my local time zone, PST, which is GMT-8. The only problem I see with this is, well, I don't know how reliable the PHP Auto-detect Daylight Savings is... anyone know? All I know is this works fine with me right now (I'm using it to ouput the current date.). First Update: It seems to work fine! However, can someone find a way to make it so that the Daylight Savings changes according to the user's settings instead of the server's settings? (BTW, the last variable is the one that determins DST settings, the -1.) Second Update: I've just discovered the [dst_in_use] variable, so I've tried making use of it. However, it subtracts an hour when I turn on DST instead of adding... so here's a workaround. Also, the mktime()'s DST support isn't all that great... anywhoo... here's the code: CODE $member_date = $info['last_visit']; $server_offset = "+8"; date ("M j Y, h:i A", mktime (date("H", $member_date)+$info['time_offset']+$server_offset+$info['dst_in_use'],date("i", $member_date),date("s", $member_date),date("m", $member_date),date("d", $member_date),date("Y", $member_date),0)); Hope it works for you! This post has been edited by ctiga: Nov 3 2003, 05:51 PM -------------------- Timothy R. Yung | Yungsters | Inverted Tekniks
|
|
|
|
Nov 3 2003, 07:04 PM
Post
#6
|
|
|
Newbie ![]() Group: Members Posts: 82 Joined: 21-October 03 Member No.: 56,737 IPB Version: Not Applicable |
Nice... works good, but I'll just leave this time thing for awhile... getting the bigger picture working first
-------------------- |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 15th March 2010 - 01:11 PM |