Brian Dunning's FileMaker Custom Functions

RandomDate

creates a random date between the specified first and last dates, inclusive

  Average rating: 4.6 (21 votes) Log in to vote

Jeff Drake   Jeff Drake - Show more from this author
Drakeling Technologies

Share on Facebook Share on Twitter

  Sample input:
RandomDate (

Date ( 1 ; 1 ; 2015 ) ;

Date ( 9 ; 4 ; 2015 )

)
  Sample output:
4/6/2015

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

This function is designed to aid in creating “dummy” data for your FileMaker Pro database. For example, you can specify a calculation in the “Calculated value” dialog under field options and have a random date entered into each new record.

 

Comments

unin   unin, Japan
Sep 10, 2015
dateFirst + Int ( Random * ( dateLast - dateFirst + 1 ) )

Using Int() for Random is the programming pattern.
 

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 15 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: