/*将UTC时间格式转成北京时间格式
*@param {UTCTime} 需要转换的时间,如:Fri Oct 31 18:00:00 UTC+0800 2008
*@return 返回结果,如:2008-10-31 18:00:00
*/
function UTCToDate(UTCTime) {
if (UTCTime != null && UTCTime != "" && UTCTime != undefined && UTCTime != "undefined" && UTCTime != "null") {
UTCTime = UTCTime + "";
var BjTime = "";
var month = new Array();
month["Jan"] = 1; month["Feb"] = 2; month["Mar"] = 3; month["Apr"] = 4; month["May"] = 5; month["Jun"] = 6;
month["Jul"] = 7; month["Aug"] = 8; month["Sep"] = 9; month["Oct"] = 10; month["Nov"] = 11; month["Dec"] = 12;
var week = new Array();
week["Mon"] = "一"; week["Tue"] = "二"; week["Wed"] = "三"; week["Thu"] = "四"; week["Fri"] = "五"; week["Sat"] = "六"; week["Sun"] = "日";
str = UTCTime.split(" ");
BjTime = str[5] + "-";
BjTime = BjTime + month[str[1]] + "-" + str[2] + " " + str[3];
//date=date+" 周"+week[str[0]];
return BjTime;
}
}
将UTC时间格式转成北京时间格式
最新推荐文章于 2024-04-24 17:45:42 发布