Boa tarde, Fernanda
Talvez o exemplo abaixo possa te servir, dê uma olhada:
function run(){
function getRandomNumber(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}
function generateRandomSequence(length) {
let sequence = '';
for (let i = 0; i < length; i++) {
sequence += getRandomNumber(0, 9);
}
return sequence;
}
function generateFormattedDateString() {
const currentDate = new Date();
const year = currentDate.getFullYear();
const day = currentDate.getDate().toString().padStart(2, '0');
const month = (currentDate.getMonth() + 1).toString().padStart(2, '0');
const randomSequence = generateRandomSequence(6);
return `${year}.${day}${month}${randomSequence}`;
}
return generateFormattedDateString();
}
Um exemplo de resultado: 2023.0708560938