How to get the current date/time in Javascript
The standard way to get the current date/time is to use new Date() (opens new window) which will return a new date object set to the current date/time. You can then manipulate the object to retrieve specific properties of a date such as day (opens new window), month (opens new window), year (opens new window), hour (opens new window), minute (opens new window), etc.
JS
Copy code
Another way to get the current date/time is to use Date.now() (opens new window) which will return the number of milliseconds elapsed since the epoch. While this isn't very friendly to display to users, it is useful for storing in a database as a timestamp when things are create or modified.