I am automating an application where records can be opened between specified date ranges. I know that I can create an array that randomly picks a number in my array, such as:
DateTime.Now.AddDays(90).ToString("MM/dd/yyyy")
However, I would like to know if there is a better way to go about this. Please help! Thanks.
void Main()
{
Console.WriteLine(DateTime.UtcNow.AddDays(new Random().Next(90)));
}
This will add a random amount of days to the start date, essentially ending up with a random date.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With