48
Views
3
Comments
How to generate random date

Hi,
Is there any way that I can generate a random date ? I plan to generate a random date and assign it as a birthdate.


Thank you

2025-03-19 06-26-09
Mayur Budukale
Champion

Hi, You can use

https://www.outsystems.com/forge/component-overview/677/randomizer-number-generator

All you'll need is to generate 3 different types of dates. ex in case of MM/DD/YYYY

Run this program three times in the flow to first get the month just check that the value should not exceed 12. You can pass min num or max num to params.

 Run the same with 2 digits for Date not exceeding 28-29-30 or 31 days based on the month. https://www.outsystems.com/forge/component-overview/10524/number-of-days-in-month can help here

Then do the same excercies for 4 digits. And lastly pass the data to NewDate()

2023-03-16 16-29-51
Paulo Rosário

Hello Dianara,

You will be able to accomplish this by using this forge component: Randomizer Number Generator

and the system function NewDate() 

This function will allow you to create a new date using Integers values, that you can set with the randomized.

I hope it helps!

Paulo Rosário


 
2023-09-06 07-26-35
Sudip Pal

Hey Dianara,

I am attaching a PNG file.You need to use JS to generate random dates.

Hope this will help you!

Thanks,

Sudip Pal

Capture.PNG
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.