Skip to content
Advertisement

How do I get the current time only in JavaScript

How can I get the current time in JavaScript and use it in a timepicker?

I tried var x = Date() and got:

Tue May 15 2012 05:45:40 GMT-0500

But I need only current time, for example, 05:45

How can I assign this to a variable?

Advertisement

Answer

JavaScript

or

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement