Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-10-2002, 11:00 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Time Offset

Can anyone please tell me how to set the timezoneoffset for the following lines of code? I have tried to figure it out with no success.

PHP Code:
 $time_lastup strtotime($weatherdata[lastup]);
  
$weather[updatedate] = vbdate($dateformat,$time_lastup);
  
$weather[updatetime] = vbdate($timeformat,$time_lastup); 
Reply With Quote
  #2  
Old 08-10-2002, 12:29 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$time_lastup+=($bbuserinfo['timezoneoffset']-$timeoffset)*3600
Reply With Quote
  #3  
Old 08-10-2002, 12:40 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you, sir.

So it should look like this when I am done, right?

PHP Code:
$time_lastup strtotime($weatherdata[lastup]);
  
$weather[updatedate] = vbdate($dateformat,$time_lastup+=($bbuserinfo['timezoneoffset']-$timeoffset)*3600);
  
$weather[updatetime] = vbdate($timeformat,$time_lastup+=($bbuserinfo['timezoneoffset']-$timeoffset)*3600); 

Quote:
Originally posted by Xenon
$time_lastup+=($bbuserinfo['timezoneoffset']-$timeoffset)*3600
Reply With Quote
  #4  
Old 08-10-2002, 12:52 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

no, put the code i gave you in a new line after the first line
Reply With Quote
  #5  
Old 08-10-2002, 01:03 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Like this?

PHP Code:
  $time_lastup strtotime($weatherdata[lastup]);
  
$time_lastup+=($bbuserinfo['timezoneoffset']-$timeoffset)*3600
  $weather
[updatedate] = vbdate($dateformat,$time_lastup);
  
$weather[updatetime] = vbdate($timeformat,$time_lastup); 
Does there have to be a semi-colon at the end of the new line?
Reply With Quote
  #6  
Old 08-12-2002, 12:47 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

of course there have to be a ;

and yes this should be correct now
Reply With Quote
  #7  
Old 08-12-2002, 10:07 PM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's for JR's weather hack. Does it work Boofo?
Reply With Quote
  #8  
Old 08-13-2002, 07:11 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For some reason, it isn't working quite right. It changes the time OK, but now instead of being at the server time, it is 6 hours behind the server now. The server is set at GMT and my timeoffset is at -6. The weather time is showing up 12 hours behind me now instead of 6 hours behind like before. Any ideas on this one, buddy?
Reply With Quote
  #9  
Old 08-13-2002, 10:44 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmm, try to replace all + with an - and all - with an +
Reply With Quote
  #10  
Old 08-13-2002, 11:14 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here's the code with the changes you suggested.

PHP Code:
$time_lastup strtotime($weatherdata[lastup]);
  
$time_lastup-=($bbuserinfo['timezoneoffset']+$timeoffset)*3600;
  
$weather[updatedate] = vbdate($dateformat,$time_lastup);
  
$weather[updatetime] = vbdate($timeformat,$time_lastup); 
It almost works. The time is showing (when logged in) at 1/2 hour ahead of my time. At 7:10 pm it shows 7:40 pm. But when logged out it shows 11 1/2 hours behind. It shows yesterday at 7:40 pm when it is today at 7:10 pm.

Quote:
Originally posted by Xenon
hmm, try to replace all + with an - and all - with an +
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:43 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04290 seconds
  • Memory Usage 2,258KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete