Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
Training
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


Privacy Policy



FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.

 

 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

isDaylightTime ( dt )

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 4.3  (29 votes)
  Discuss this Custom Function

Howard Schlossberg, FM Professional Solutions
http://fmprosolutions.com

Returns 1 or 0 to indicate whether the given date falls within U.S. daylight savings time (post-2007)

Sample Input:
isDaylightTime ( date( 5; 1; 2014 ) )
Sample Output:
1


 Then copy & paste into FileMaker Advanced's Edit Custom Function window.

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed

Description:

Returns 1 or 0 to indicate whether the given date falls within U.S. daylight savings time (post-2007)

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

This is my Custom Function and I want to edit it

Discuss:

There is a mistake in the DSTEnd calc., it should be identical to the DSTBegin calc except for the month/day values.

Instead of simply fixing it that way, I made the following modification

dow_oset = floor( mod( 1 + ( yr * 1.25); 7) );
DSTBegin = date( 3 ; 14 ; yr ) - dow_oset;
DSTEnd = date( 11 ; 7 ; yr ) - dow_oset

An interesting detail to note is DST is a constant at 238 days. Therefore DSTEnd can be obtained thusly:

DSTEnd = DSTBegin + 238

Additionally, there is a DayOfWeek function, so the following is equivallent

dow_oset = DayOfWeek(date(3, 1, yr))

Here is the entire rewrite:

Let([
yr = Year(dt);

// DSTBegin is 2nd Sunday of March, minimum is the 8th.
FirstPossibleSunday = Date(3; 8; yr);

// Offset to 2nd Sunday of March
DSTBegin = FirstPossibleSunday + (8 - DayOfWeek(FirstPossibleSunday))
];

Case(
dt < DSTBegin ; 0 ;
dt >= DSTBegin + 238 ; 0 ;
1
)
)

Scott, Edmonton, AB
April 29, 2015 8:49pm

Thanks for your notes, Scott. Yours is certainly easier to understand than mine, which I essentially copied from some forum I found online for some other computer language when I needed a solution for whatever I was working on at the time.

Meanwhile, I've fixed the missing floor() in my calc above, and visitors now have the option of using mine or yours.

Thanks again...

Howard Schlossberg, Los Angeles
April 29, 2015 9:15pm

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
City/Location:
Comment:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 4 + 5 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. ExplodeJSON ( JSON )
  (Sat, Apr 22, 12:46am)
2. TruncateStringWithBreaks(String_with_breaks; String_without_breaks)
  (Mon, Apr 17, 3:17am)
3. AS_Photos_Export ( Export_Path ; options ; Album_Name )
  (Thu, Apr 13, 12:34am)
4. IsValidTFN ( text )
  (Fri, Mar 31, 1:07am)
5. FindComparables ( FieldList ; idFieldName )
  (Tue, Mar 28, 6:51am)
6. SecondstoTime ( seconds )
  (Fri, Mar 24, 12:25pm)
7. ReplaceOnMultipleValues ( Value ; Start ; NumberOfCharacters ; ReplacementText )
  (Fri, Mar 24, 9:18am)
8. SetVariableĆ’ ( _variableName ; _value )
  (Fri, Mar 17, 1:27pm)

RSS Feed of Custom Functions