Dynamic stamps are tricky, you have to get a lot of things right for them to work correctly.
Take a look at these resources:
Thom (the first link) also wrote "the book" about dynamic stamps. You will find a link to that excellent resource on that first page as well.
What have you tried so far?
Take a look at one of the existing dynamic stamps - e.g. the "Revised" stamp:
The stamp has one field that shows both the date and the time using the following code:
event.value = (new Date()).toString(); AFDate_FormatEx("h:MM tt, mmm dd, yyyy");
You should be able to use the same code. If you want to modify an existing stamp, take a look here: http://khkonsulting.com/2014/01/modify-dynamic-pdf-stamps-acrobat/
If you want to have two different fields for date and time, you can modify the format string and e.g. use the following for just the time:
event.value = (new Date()).toString(); AFDate_FormatEx("h:MM tt");
The same process can be used for just the date. To find out how you can format the date/time, take a look at the documentation for util.print(): Acrobat DC SDK Documentation
The Code that you provided worked for me to when I entered it in the Calculate Tab's Custom calculation script. When I entered the code here and hit OK, the stamp gets updated to display the current date and time.
Now, once I save the stamp and then I go to open up a PDF File and try to insert that stamp I had just saved. The Date and time is still the same. I know the date should be the same as the day hasn't changed, but the time should have been different.
Seems like once I save the Stamp, the date and Time in the Stamp are Static and I can't get them to update when I insert the Stamp when the Date and Times are different and also when the name is different.
Is there another setting I am missing somewhere with this function of the Stamps?
Did you create a page template for your stamp? Did you name the page template correctly? This is the correct format:
#InternalStampName=Stamp Display Name
Everything works fine now.