How to insert values in date format using - RandomUtils.nextInt

How to insert values in date format using - RandomUtils.nextInt?
For example, I have the first value - date range from 1 to 30 number + RandomUtils.nextInt(1, 30)
But I want the month and year to be also in the range of numbers, for example, the month from 1 to 12 and the year from 2022 to 2023.
I tried to substitute sequentially through "/ ", but it gave an error.

Struggling to understand exactly what you are trying to accomplish.

But if I do understand correctly you want to create a random date in the format dd/MM/yyyy
Days are between 1 and 30
Months are between 1 and 12
Years are between 2022 and 2023

Would you like to store this value as a string?

If so you can do the following:

Note: RandomUtils.nextInt excludes the max value, so to include the max value you have to increase it by 1

String date = RandomUtils.nextInt(1, 31) + '/' + RandomUtils.nextInt(1, 13) + '/' +  RandomUtils.nextInt(2022, 2024) 

If this does not help or answer your question. Please do provide more information, screenshots and code snippets to help us understand better as to what you are trying to accomplish.

A good start for helping us to understand is to have a look at the following post:

You got it right. I didn’t use " +‘/’ ", but just put " / "

@jmad kindly update the topic title and make it in english, so other users can benefit of understanding your needs.
There are plenty nationalities here in the comunity, what if everybody will start to post into the native language only?
It is ok if is not ‘pure’ english … but please make an effort.

Thank you!