Hi there, I have this in a variable: Mon Dec 24 05:59:51 UTC+0530 2012 Code (markup): I need to show it like this instead: Mon Dec 24 2012 05:59:51 Code (markup): So basically I just need to strip off the "UTC" part and move "2012" before the time. I'm able to strip the UTC part off by doing a search, but not sure how to move "2012" before the time. Or maybe some smarter way to do this in one line of code, regexp maybe? Thanks for your help.
If you are getting it from time stamp why not to use date time formats that are already available in the js.
I should have explained the whole story! I'm indeed using the date/time formats through JS. However, I need the format to be consistent across browsers. The display is standard across all browsers, except IE (tested on IE9 on Win7 and IE10 on Win8). For some reason, IE doesn't respect such a basic standard that every single browser does (even Chrome and Safari for iOS does). Hence, I'll apply a conditional that does a browser check if its IE and strip the UTC part off and move 2012 before the time. Stripping part is okay, and using indexOf method I'm able to find out the location where I need the "year" to display. Just need to figure out how to insert it now. Thanks.
What date object method are you using to generate that date? The deprecated toGMTString(), or the proper toUTCString() one? Also are you sure you're in a modern doctype and not in quirks mode? IE's jscript doesn't behave the same in quirks or certain doctypes. Part of why putting up a full working example is important when you ask a question -- as there are often more questions that need to be answered first.