简体   繁体   English

插件DataTables jquery:如何显示格式化的Date?

[英]plugin DataTables jquery : how display formated Date?

Among my source properties , I have a column created by doing javascript code 在我的源属性中,我有一列是通过执行javascript代码创建的

 var col_date =   new Date(timestamp)

It display me a column with text formated like this : Sun Feb 08 2015 00:00:00 GMT+0100 (Paris, Madrid) 它向我显示一列带有以下格式的文本: 2015年2月8日,星期日,格林尼治标准时间+0100(巴黎,马德里)

I would like to display it in MM/DD/YYYY or YYYY/MM/DD formar ( whatever , I want it short and easily readable) 我想以MM / DD / YYYY或YYYY / MM / DD形式显示它(无论如何,我希望它简短易读)

Do you know how to do it please? 你知道怎么做吗?

In DataTables, you can modify the value shown in the table in two ways: 在DataTables中,可以通过两种方式修改表中显示的值:

  1. change it in the source data, or 在源数据中更改它,或者
  2. leave the source data alone but tell DataTables to render it differently 不理会源数据,但告诉DataTables以不同的方式呈现它

It sounds like #2 is what you are looking for. 听起来#2是您要寻找的。 See the reference documentation that includes an example. 请参阅包含示例的参考文档

Another possible example here . 这里还有另一个可能的例子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM