My.ADVISOR.com Sign-In
Username
Password
Sign Up 
Go to Article
Advanced Search 

ADVISOR TIPS

Rounding Time Values in FileMaker Pro

Writing calculations that round time requires you to know how FileMaker Pro stores time. Find out what that is, and what formulas you can use.

By John Mark Osborne, Database Pros president and owner, and FileMaker Advisor technical editor

UNLOCKED -- This article is provided to subscribers of FILEMAKER ADVISOR or DATABASED ADVISOR or FILEMAKER ADVISOR. To subscribe or renew, go to Advisor Store.

Writing calculations that round time requires you to know how FileMaker Pro stores time: As a number of seconds since the beginning of the day. If you use the Data Viewer in FileMaker Advanced and reference a time field via the GetAsNumber function, it displays the number of seconds that have elapsed since 12:00:00 AM. In other words, 12:00:00 AM returns a zero (0) and 12:00:01 AM returns a one (1).

There are 86,400 seconds in one day, 3,600 seconds in one hour, and 900 seconds in a quarter hour. With this knowledge you can round time to any value you want. For example, you might want to round the time entered to the nearest quarter hour. You could use the following formula in an auto-enter calculation to modify any entry, a validation to make sure times are entered in quarter hours only, or anywhere the calculation dialog lets you enter a formula.

Round(MyTimeField / 900; 0) * 900

If you prefer to always round up, use this formula:

Truncate((MyTimeField - 1) / 900; 0) * 900 + 900

Rounding Time

No reader comments ... yet.

    What do YOU think about this topic? Share your advice and thoughts using this form.

    Your Name

    REQUIRED : PUBLIC

    Your E-Mail

    REQUIRED : PRIVATE

    Job, Company

    OPTIONAL : PUBLIC

    City, State, Country

    OPTIONAL : PUBLIC

    Your Web Site

    OPTIONAL : PUBLIC

    Your Comment

    Please help everyone by keeping your comments on-topic, using clean language, and not defaming or making personal attacks.


    Your e-mail address is required, but it will not be displayed to the public or given to anyone. See our Privacy Policy. Comments become visible after they pass our spam filter, and spammers and abusers are permanently blocked. Please report spam or abuse.

    John OsborneTechnical editor John Mark Osborne is president and owner of Database Pros, offering FileMaker resources on the Internet. He is author of Scriptology, a speaker at FileMaker Developer Conferences and Macworld conferences, and a trainer for the Professional Training series created by FileMaker, Inc. http://www.databasepros.com jmo@filemakerpros.com

    Printer-friendly
    page layout

    Keyword Tags: FileMaker, FileMaker Development, FileMaker FileMaker Pro

    ADVISORAMA
    If you cannot convince them, confuse them.
    -- Harry S. Truman, American president (1884-1972)

    ARTICLE INFO

    FileMaker Advisor

    Web Edition: 2008 Week 06, Doc #19363

    Print Edition: February/March 2008, Page 37

    SUBSCRIBER ONLY ARTICLE LOCKED

    Subscribe to FileMaker Advisor Magazine

    Read the advanced guide to creating custom business database solutions with FileMaker software. Subscribe now to gain access to all the archives and downloads.

    FileMaker.Advisor.com

    Subscribe to Advisor Basics of FileMaker Pro

    Learn the fundamentals of using FileMaker Pro software. Every issue gives you step-by-step instructions on creating the databases you need. Subscribe now!

    FileMaker.AdvisorBasics.com

    Secrets Of The Top Experts -- Now!

    See exactly how to do it, step-by-step, in Advisor Academy CDs created by the top experts. Click to see what you can learn right now.

    AdvisorAcademy.com

    Free E-Newsletters

    Keep up! Hot News, How-To, Tips & Tricks, Expert Advice, and more. Click to request your's free.

    AdvisorUpdate.info

    Need Know-How Now?

    What direction are you going with your business? Advisor Guides are packed with the answers you need to work smarter. Can you afford to fall behind?

    AdvisorStore.com

    Showcase Your Smarts

    Submit your tips, techniques and advice and let Advisor promote your business and build your career. Show the world what you know!

    AdvisorTips.com

    Use of this or any other site, content, product or service of Advisor Media constitutes acceptance of Terms of Use.
    Portions copyright ©1983-2008 Advisor Media, Inc. All Rights Reserved.
    Reuse or reproduction of any portion or quantity of Advisor Media's copyrighted content, in any form, for any purpose, requires written permission.
    ADVISOR®, the ADVISOR logo, and other names and logos that incorporate ADVISOR are registered trademarks, trademarks or service marks of Advisor Media, Inc. in the United States and/or other countries.
    Other trademarks are used for identification, editorial or descriptive purposes and are the property of their owners.
    osboj037-05 posted 02/04/2008 modified 05/12/2008 03:43:37 AM ztfmfd/ztfmfd
    domino-144.advisor.com my.advisor.com 05/16/2008 12:28:10 PM