views:

50

answers:

3

How to format this date type 2010-06-24T00:00:00Z to sun,24/06/10 7.15 p.m (CDT). using javascript or jquery.

sun,24/06/10 7.15 p.m (CDT) this is just a format representation which i need & not the actual date of the above string.

Appreciate the quick response

Thanks in advance!

A: 

This article may help you: ECMAScript ISO Date For Every Browser

galambalazs
For the other half (rewriting): http://blog.stevenlevithan.com/archives/date-time-format for `dateFormat(Date.ISO('2010-06-24T00:00:00Z'), 'ddd, dd/mm/yy h.MM t."m". (Z)');`
Jonathan Lonowski
Simpler version with limitation which i came up:var weekday=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function formatUTCdate(time){var date = new Date((time || "").replace(/-/g,"/").replace(/[TZ]/g," "));return weekday[date.getDay()]+","+(date .getMonth()+1 ) + "/" + date.getDate() + "/" + date .getFullYear()+"<br/>"+ date.toLocaleTimeString().toLowerCase();}document.write("date"+formatUTCdate("2010-08-06T00:00:00Z"));
jaan
sorry formatting is not working or i dont know:)
jaan
you need to wrap it between two ` (Alt+7 on my keyboard)
galambalazs
Thanks Jonathan Lonowski, i have used ur tip.
jaan
A: 

Pretty simple with JS -

var d_names = new Array("sun", "mon", "tue", "wed", "thu", "fri", "sat");
var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth();
curr_month++;
var curr_year = d.getFullYear();
document.write(d_names[curr_day] + ", " +curr_month + "/" + curr_date + "/" + curr_year);

and bob's your uncle...

eddt
A: 

I recommend jQuery Globalization Plugin from Microsoft

http://weblogs.asp.net/scottgu/archive/2010/06/10/jquery-globalization-plugin-from-microsoft.aspx

example:

jQuery.format(new Date(1955,10,5), "dddd MMMM d, yyyy"); // Saturday November 5, 1955
Alexandre