Search these areas:
Help
Support Forums
Product Info



-Introduction
-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Views
-Templates
-Components
-Data Analysis
-Members
-Security
-Importing
-Exporting
-FTP
-JavaScript
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-Glossary
-New Responsive UI Module





DataWeb Help
Support Forums
Tutorial
Script Library
Knowledge Base

Home > Support

Script Library

  Is it Daylight Saving Time
 
  chubbard posted this script:
  The following script will return whether or not it is currently daylight saving time (U.S.).

webcall function isDST()
{
var today = new date();
var today = date(today - 2*60*60*1000); //subtract 2 hours, since starts at 2 AM
var m = today.getmonth() + 1;
if (m < 4 || m > 10)
    return false;
if (m > 4 && m < 10)
    return true;
//month is April or October
if (m == 4)
    {
    if(today.getdate() - today.getday() - 1 >= 0)
        return true;
    }
else
    {
    if(today.getdate() + (7 - today.getday()) <= 31)
        return true;
    }
return false;
}

Note that the first three lines can be modified as follows to allow the function to take an arbitrary date:
webcall function isDST(testDate)
{
var today = new date(testDate);
...
 
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
DataWeb, 720 North 10th Street, A #145, Renton, Washington 98057 *425-583-5970* Fax 484-770-4706* Email Us