print date like 'Y-m-d H:i:s"in javascript -


What is built in JavaScript in a format formatted a date object in a format such as "Ymd H: i: s" Does it?

i

 after  var = new date (xhr.getResponseHeader ("last-modified")); Warning ("Modified:" ++GetDate +). '+ (Since. Gatemonth () + 1) +'. + + Since .gatehors () + ':' + since.getMinutes ())  

But it is cut off from all the leading zeros

You try it Can:

  Leading the function (S, Max) {var z = max-s.length + 1; Z = z & gt; 1? Array (Zed). Joint ('0'): ''; Return (Z + S); } Warning ("Modified ::" + pioneer (since.getDate), 2) + '. * * Leading Leading (because Gitmonoth (+) + 1,2) +'. '+ Leading Zero (since .gatehors ), 2 ));  

But I recommend using a library to handle dates in JS. It is made in a formatter and can do many other things.

At the moment you can do this:

  var d = moment (since); Alert (D. Format ('YYYY-MM-DD HH: mm: ss'));  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -