您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

格式化Json传递日期的方法

2024/3/20 17:59:25发布30次查看
自定义日期类型转化函数changedateformat,将//date(1294499956278+0800)//形式的函数转化为2014-5-2形式
function changedateformat(jsondate) { jsondate = jsondate.replace("/date(", "").replace(")/", ""); if (jsondate.indexof("+") > 0) { jsondate = jsondate.substring(0, jsondate.indexof("+")); } else if (jsondate.indexof("-") > 0) { jsondate = jsondate.substring(0, jsondate.indexof("-")); } var date = new date(parseint(jsondate, 10)); var month = date.getmonth() + 1 < 10 ? "0" + (date.getmonth() + 1) : date.getmonth() + 1; var currentdate = date.getdate() < 10 ? "0" + date.getdate() : date.getdate(); return date.getfullyear() + "-" + month + "-" + currentdate; }
以上就是格式化json传递日期的方法的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product