Javascript将国际日期转换成本地日期的函数
JavaScript #日期 #函数2012-06-16 09:10
直接上代码:
//将国际化日期转化成本地日期yyyy-MM-dd function f_ToDate(num) { //Fri Oct 31 18:00:00 UTC+0800 2008 num = num + ""; var date = ""; var month = new Array(); month["Jan"] = "01"; month["Feb"] = "02"; month["Mar"] = "03"; month["Apr"] = "04"; month["May"] = "05"; month["Jun"] = "06"; month["Jul"] = "07"; month["Aug"] = "08"; month["Sep"] = "09"; month["Oct"] = "10"; month["Nov"] = "11"; month["Dec"] = "12"; //var week = new Array(); //http://yige.org //week["Mon"] = "一"; week["Tue"] = "二"; week["Wed"] = "三"; week["Thu"] = "四"; week["Fri"] = "五"; week["Sat"] = "六"; week["Sun"] = "日"; str = num.split(" "); date = str[5] + "-"; date = date + month[str[1]] + "-" + str[2]; //date=date+" 周"+week[str[0]]; return date; }
相关文章
- Javascript从外部Excel文件中读取数据 2012/06/16
- Javascript创建一个选择文件的弹窗 2012/06/16
- Javascript把数据导出到外部Excel文档 2012/06/16
- js禁止刷新_屏蔽Alt+F4的代码 2012/06/14
- JS把预定义的字符转换为HTML实体的函数htmlspecialchars 2012/06/07
- JS函数中arguments对象的使用 2012/06/05
- javascript回调函数及推论 2012/05/30
- JS动态创建带name的iframe在IE下跳转问题 2012/05/28
- JS实现俄罗斯方块 2012/05/24
- JavaScript编码模式 2012/05/23