Javascript get and format current date
date, format, javascript
Solution
you can use this.
function dateTest(){
var d =new Date();
var month_name=new Array(12);
month_name[0]="Jan"
month_name[1]="Feb"
month_name[2]="Mar"
month_name[3]="Apr"
month_name[4]="May"
month_name[5]="Jun"
month_name[6]="Jul"
month_name[7]="Aug"
month_name[8]="Sep"
month_name[9]="Oct"
month_name[10]="Nov"
month_name[11]="Dec"
alert(month_name[d.getMonth()]+" "+d.getDate()+" , "+d.getFullYear());
}
Problem
Possible Duplicate: Formatting a date in JavaScript I need to show a current date in format like this (some examples): ``` sep 10, 2012 nov 5, 2012 ``` and so on. Using `javascript` I get a current date object ``` var date = new Date(); ``` what I need to do next?