Brian Dunning's FileMaker Custom Functions

RoundTS

Round a timestamp value to nearest minute value defined by seconds

  Be the first to rate this function Log in to vote

Jeff Morrison   Jeff Morrison - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
RoundTS ( Get ( CurrentHostTimestamp ) ; 300 )
where current timestamp is 1/1/2023 02:03:33
  Sample output:
1/1/2023 02:05:00

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Call this function and hand it 2 parameters: timestamp & number representing seconds to round.

For example:
Insert Calculated Result [Select ; TableName::FieldName; RountTS ( Get ( CurrentHostTimestamp) ; 300 )]

This would get the current host timestamp, round it using the 300 seconds (5 minutes) then insert that value into the chosen field.

 

Comments

Michael Horak   Michael Horak, *COMMENT Visual Realisation
Mar 17, 2023
How about simply:

GetAsTimestamp (
Round ( given_timestamp / precision ; 0 ) * precision
)

The value of the precision parameter can be given as time or as a number of seconds.
 

Log in to post comments.

 

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

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: