使用Ajaxpro的日期格式

时间:2009-05-01 02:54:18

标签: date format ajaxpro

我正在使用AjaxPro来检索数据库,日期字段返回 Sat Apr 3 00:00:00 UTC + 0700 1982 我希望将其格式化为“dd / mm / yyyy”。

1 个答案:

答案 0 :(得分:2)

假设您从服务器获取DateTime值,您可以执行与此类似的操作:

访问http://www.ajaxpro.info/Examples/DataType/default.aspx 并在Firebug中运行以下代码。

var result = AJAXDemo.Examples.DataType.Demo.GetDateTime(new Date()).value;
var year = result.getFullYear();
var month = result.getMonth() + 1;
var day = result.getDate();
var formattedDate = [day, month, year].join('/');
console.log(formattedDate);
相关问题