Form filled with current date and time of the script being run

I am trying to test the addition of a new device and each device number must unique. I am thinking that if I can somehow fill the Device Number form with the current date and time of execution (using military time), that would eliminate any duplicates and the device would be added correctly. For example, if I ran it now, Device Number would be 9251408 (9/25 at 2:08pm) and if I run it at 1:15am it would be 926115. Any thoughts on how to do this?

I am not savvy when it comes to scripting, so I am having a hard time finding anything I can follow online

Using Groovy:

def now = new Date()

println now.format(“MMddHHmmss”)

will print 0925185243 to the console (I added ss = seconds in format)