Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
How generate 10 Random Date between 2 Dates
First get the two dates in a variable.
Calculate the difference.
let vStartDate = num(date#('1-1-2016', 'D-M-YYYY'));
let vEndDate = num(date#('6-3-2016', 'D-M-YYYY'));
let vNumberOfDates = $(vEndDate) - $(vStartDate) + 1;
Create a table (using AutoGenerate) in which you randomly general number and multiply that by the difference.
theTable:
LOAD
date(floor(rand() * $(vNumberOfDates)) + $(vStartDate)) as RandomDate
AutoGenerate 10
;
See attachment.
Hi,
another solution could be:
table1:
LOAD Date(MinDate+Floor(Rand()*(MaxDate-MinDate))) as RandDate
While IterNo()<=10;
LOAD '2016-01-01' as MinDate,
'2016-03-06' as MaxDate
AutoGenerate 1;
hope this helps
regards
Marco
Very good.
Thaanks
If your question is now answered, please flag the Correct Answer (and optionally Helpful Answers).
If not, please make clear what part you still need help with .