Need Help in Formatting Date "Fri Jul 6 16:01:56 EDT 2007"
Hi All,
Can any one help me in formatting Date? I want to send CURRENT date to client in following format:
"Fri Jul 6 16:01:56 EDT 2007"
I tried few things but did not get exact format. Please give me code that works on all browsers at least on FF and IE. Please help me out.
Thanks,
Ninad Shaha
Last edited by shahaninad; 10-06-2008 at 02:17 AM.
Reason: some imp text missed
Nothing wrong with the format, but to get a Date object you need to create a new Date with the result of Date.parse.
var s="Fri Jul 6 16:01:56 EDT 2007";
alert(new Date(Date.parse(s)));
If you want to display a different string than the computer default, you can redefine the Date.prototype.toString method,
but it would be better to just write a method that converts the string the way you want.
Bookmarks