Welcome Guest ( Log In | Register )

UploadScript

Check out the FREE chatroom mod for IPB 3.x

> About IPB SDK

Bugs should be reported on the Bug Tracker. To download the latest bleeding-edge version of the SDK, head over the SVN repository.

 
Reply to this topicStart new topic
Date/Time from SDK, Not sure what to fix here.
Shihiko
post 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? pinch.gif

I guess the board settings aren't effecting this one... huh.gif


--------------------
Go to the top of the page
 
+Quote Post
cowweb
post 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 smile.gif Anyway, I will fix this for the 0.5.1 version which should be ready by today or tommorow smile.gif

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 smile.gif

Cow


--------------------
Go to the top of the page
 
+Quote Post
Shihiko
post 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 wink.gif but thanks for the idea... biggrin.gif


--------------------
Go to the top of the page
 
+Quote Post
cowweb
post 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


--------------------
Go to the top of the page
 
+Quote Post
ctiga
post 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! happy.gif

This post has been edited by ctiga: Nov 3 2003, 05:51 PM


--------------------
Timothy R. Yung | Yungsters | Inverted Tekniks
Go to the top of the page
 
+Quote Post
Shihiko
post 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 wink.gif


--------------------
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 13th March 2010 - 03:20 AM
Invision Skins · IPB Skins