javascript - 扩展 datejs 以解析字符串 2013 年 4 月 25 日 1200

标签 javascript datejs

如何扩展 datejs解析“2013 年 4 月 25 日 1200”?

最佳答案

我猜你需要使用 Date.parseExact :

Date.parseExact ( String dateString, String formatStringOrArray ) : Date

Converts the specified string value into its JavaScript Date equivalent using the specified format (string) or formats (array). The format of the string value must match one of the supplied formats exactly.

示例:

Date.parseExact("25 Apr 2013 1200", "d MMM yyyy Hm");

引用: https://code.google.com/p/datejs/wiki/APIDocumentation#parseExact

关于javascript - 扩展 datejs 以解析字符串 2013 年 4 月 25 日 1200,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16221088/

相关文章:

javascript - iPhone:使用 CSS/Javascript 进行开发的优点和缺点是什么?

javascript - 使用 Canvas 在嵌套圆圈中添加文本?

javascript - 我应该发送原始数据还是 Html 作为 Ajax 响应?

javascript - Fabric.Js - 使已添加到 Canvas 的文本可编辑

javascript - 如何在 Bootstrap 日期时间小部件中添加或减去日期、天、月?

javascript - Datejs 和 d3.js 与过渡冲突

javascript - 替换 Javascript 中的插入符号

javascript - 初学者 : javascript date conversion from string to UTC date. js 进入 SharePoint 列表

javascript - 使用 Datejs - 获取星期几

javascript - Date.js : Date. now() 行为异常