vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How do I check for DST? (https://vborg.vbsupport.ru/showthread.php?t=71237)

Boofo 11-01-2004 08:36 AM

How do I check for DST?
 
Can someone please tell me why this doesn't work and how to fix it?

PHP Code:

 if (!$post['dstonoff']) {
    
$post['tzoffset']--;
}else{
   
// DST is on, add an hour
$post['tzoffset']++;


It seems it wants to grab whatever I am checking for first and not go any further. I always have to change this whenever DST goes off or on. ;)

Boofo 11-02-2004 08:54 PM

Nobody can help me with this? ;)

Boofo 11-15-2004 09:49 PM

I'll try one more time asking for help. ;)

Natch 11-16-2004 02:33 AM

The wy vB does it is via a test in Javascript at the bottom of the page, and if th etest is true, it runs a cron which updates the user profile (I think?) - it's not by any means a simple thing...

Boofo 11-16-2004 04:18 AM

Quote:

Originally Posted by Natch
The wy vB does it is via a test in Javascript at the bottom of the page, and if th etest is true, it runs a cron which updates the user profile (I think?) - it's not by any means a simple thing...

The code above works if you only use one of them. Then it works right. But if you try to "else" them, then it only picks the first one, no matter which one it is. How can I get it to work with "else"?

Natch 11-16-2004 04:30 AM

Is dstonoff a TRUE/FALSE item? the only way that (!$post['dstonoff']) would never return the first (or second) clause is if $post['dstonoff'] is never FALSE (or TRUE)...

Boofo 11-22-2004 08:41 AM

Quote:

Originally Posted by Natch
Is dstonoff a TRUE/FALSE item? the only way that (!$post['dstonoff']) would never return the first (or second) clause is if $post['dstonoff'] is never FALSE (or TRUE)...

All I know for sure is that whichever one I put first always works. How would I check for it then? ;)

Natch 11-23-2004 02:15 AM

try
PHP Code:

if ($post['dstonoff']===TRUE
{   
// DST is on, add an hour
    
$post['tzoffset']++;
}
else
{
    
$post['tzoffset']--;



Boofo 11-23-2004 02:42 AM

Quote:

Originally Posted by Natch
try
PHP Code:

if ($post['dstonoff']===TRUE
// DST is on, add an hour
$post['tzoffset']++;
}
else
{
$post['tzoffset']--;



I'll try this and let you know. ;)

Should there be 3 equal signs?

Natch 11-23-2004 02:47 AM

Yeah: it's a more exact test...


All times are GMT. The time now is 11:44 PM.

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.01513 seconds
  • Memory Usage 1,736KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete