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
Post a Comment