<html> <body> <script language="javascript"> function myFunction(){ var date = new Date(); alert(date.toString()); } </script> <button onclick="myFunction();">Today's date</button> </body> </html>