[AccessD] Create a random date/time

Bill Benson bensonforums at gmail.com
Sat Aug 29 19:19:35 CDT 2015


On Aug 29, 2015 8:18 PM, "Bill Benson" <bensonforums at gmail.com> wrote:
>
> I don't have a dog in the fight here Stuart.
>
> I am not coming up against anything.
>
> If you don't want to treat the rounding error ramifications by limiting
the results to the lb and ub dates, then you live with the results.
>
> That's all I was pointing out.
>
> I have no use for this function presently but thought I owed it to the
thread participants, especially Gustav, to point out the clarification.
>
> Signing off!
>
> On Aug 29, 2015 8:14 PM, "Stuart McLachlan" <stuart at lexacorp.com.pg>
wrote:
>>
>> Not really a flaw, you are coming up against a rounding error.
>>
>> Since there are only 86,400 seconds in a day, In 1,000,000 random
numbers you are going
>> to get a few which round up to 1 when converted  to a DateTime and
displayed to the nearest
>> second (the default).   On average, you will get the next day once in
every 172,800 iterations
>> if you just want times in a single date.   That number is multiplied by
the number of days in
>> your range, so if you want a random date within 365 days, it will only
happen once on
>> average in 63 million iterations.
>>
>> Do you still get the same problem if you use  ? Format(dtMax,"d mmm yyy
hh:nn:ss:ms")
>>
>> --
>> Stuart
>>
>>


More information about the AccessD mailing list