JS将日期转换为英文格式输出
<script language="javascript"> var dt = new Date(); var m=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Spt","Oct","Nov","Dec"); var w=new Array("Monday","Tuseday","Wednesday","Thursday","Friday","Saturday","Sunday"); var d=new Array("st","nd","rd","th"); mn=dt.getMonth(); wn=dt.getDay(); dn=dt.getDate(); var dns; if(((dn%10)<1) ||((dn%10)>3)){ dns=d[3]; } else { dns=d[(dn%10)-1]; if((dn==11)||(dn==12)){ dns=d[3]; } } document.write(m[mn]+" "+dn+dns+" " +w[wn-1]+" "+dt.getFullYear()); </script>
输出格式:Feb 12th Wednesday 2014
技术文档