Here you are (suggest you ignore the unhelpful posts - webdev1958/bullant cannot resist making sneering comments, rather than offering any help):-
Code:
<script type = "text/javascript">
var mths = ['January','February','March','April','May','June','July','August','September','October','November','December'];
var str = "2012-03-21"; // the date you specified YYYY-MM-DD
var sp = str.split("-");
var yr = sp[0];
var mth = Number(sp[1])-1; // months in javascript are 0-11
var mthname = mths[mth];
var day = Number(sp[2]);
day = day + ["th","st","nd","rd"][!(day%10>3||Math.floor(day%100/10)==1)*day%10];
var finaldate = day + " " + mthname + " " + yr;
alert (finaldate);
</script>
Obviously one having captured the component parts of the date you can manipulate their order to display them in any format you wish. You could also easily add the name of the weekday if you wished.
"A good reputation can take years to aquire, a bad one takes a few seconds"
__________________
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Last edited by Philip M; 03-21-2012 at 12:30 PM..
Reason: Typo
Here you are (suggest you ignore the unhelpful posts):-
Code:
<script type = "text/javascript">
var mths = ['January','February','March','April','May','June','July','August','September','October','November','December'];
var str = "2012-03-21"; // the date you specified
var sp = str.split("-");
var yr = sp[0];
var mth = Number(sp[1])-1; // months in javascript are 0-11
var mthname = mths[mth];
var day = Number(sp[2]);
day = day + ["th","st","nd","rd"][!(day%10>3||Math.floor(day%100/10)==1)*day%10];
var finaldate = day + " " + mthname + " " + yr;
alert (finaldate);
</script>
Obviously one having captured the component parts of the date you can manuipulate their order to display them in any format you wish. You could also easily add the name of the weekday if you wished.
"A good reputation can take years to aquire, a bad one takes a few seconds"
Thank you, ill take a look at that soon as i get home