-2

I've got trivial question for which I can't find simple answer - how can I format Date object in order to get it in format I need? For example, "20.01.2014". I know about moment.js library but I must do it using only native JS. Please, give me answer. Thanks!

malcoauri
  • 10,195
  • 24
  • 72
  • 124
  • 2
    Maybe [this](http://stackoverflow.com/questions/3552461/how-to-format-a-javascript-date) will help? – Martin Oct 15 '15 at 12:50

1 Answers1

0

You use the getHours, getMinutes, and getSeconds (or getUTCHours, getUTCMinutes, and getUTCSeconds) methods on your Date instance, which give you numbers, and then do the formatting with string manipulation.

T.J. Crowder
  • 879,024
  • 165
  • 1,615
  • 1,639