jquery - JavaScript Date.toString() radix argument error -


why won't following code output date string!?

var d1 = date.parse('10/29/1990 12:00:00 am'); console.log(d1.tostring('dd/mm/yyyy')); 

the error is:

uncaught rangeerror: tostring() radix argument must between 2 , 36

just trying format date...

because d1 not date object, number. date.parse returns milliseconds representation, need feed new date or use date constructor directly.

and because javascript not have native date-formatting function, there implementation-dependent tostring , tolocalstring , standardized toisostring , toutcstring (though not supported in older ie). instead, have formatting manually getting single components , concatenating them. luckily, there's bunch of libaries that.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -