Format dates in Javascript -
I have to log my error with some error, for that I am using the following code:
var dLogDate = new date (); Console.log (dLogDate.toString (). Substring (4) + ',' + dLogDate.toGMTString (). Substring (4)); According to the code output given above it is as good as what follows, but I do not need it:
"10 October 2014 12:48: 59 GMT + 05:30 (IST), 10 October 2014 07:18:59 GMT "I want as follows:
" October 10, 2014 12:48: 59 (IST), 10 October 2014 07:18:59 (GMT) " Watch before the date", ". I need to instal 10th October of 10th October Can be done with some functions that are transferring 4 characters from string and contrast to third position, but I'm still curious to know if there is any other easy way to do this? I do not want to use any third party's library / script.
Thanks
You can use date format format date
Var Medium Index = date.getMonth (); Var dayIndex = date.getDay ();
var monthArray = ['Jan', ....]; Var dayArray = ['Sunday', ...]
console.log (Monthly [Month Index] + "-" + Day [Day Index]);
Comments
Post a Comment