Jump to content

Insert Random Date


This topic is 7263 days old. Please don't post here. Open a new topic instead.

Recommended Posts

hi there everyone... i have a little project that i am trying to finish. i have a field that is a date. i'm trying to create a script that will create a random date with a range of the year 2000 and 2001. the dates can be duplicated just within these years. any help would be great...

thanx

Link to comment
Share on other sites

In FM dates are stored as number of days starting at January 1, 1900. to generate a random date you can use the Random function to pick a random number between zero and one and scale by the date range you wish. Your function might look like:

RandomDate (calculation, date) =

Date(1,1,2000) + Int(730 * Random)

This should be a stored calculation so that once selected it doesn't recalculate.

-bd

Link to comment
Share on other sites

quote:

Originally posted by LiveOak:

In FM dates are stored as number of days starting at January 1, 1900.

-bd

Whoops. I think you'll find that it is actually January 1,0001, not January 1, 1900. Of course there was no such date as Janaury 1,0001, but FileMaker Pro treats it as 1.

HTH

Old Advance Man

Link to comment
Share on other sites

This topic is 7263 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.