Javascript字符串到日期的转换-简单吗? [英] Javascript string to Date conversion - simple?
问题描述
昨天,我设法解决了这个问题,但是由于高清的死机,我失去了一天的工作。现在我不记得自己做了什么修复,但是我知道可以解决。
Yesterday I managed to solve this, then lost a day's work due to the death of a HD. Now I cannot remember what I did to fix it, but I know it can be done.
输入:字符串日期,格式为 m / d / yy,例如'12 / 25/10'或'4/1/10'(4月1日)
输出-日期对象
Input: string date in the format 'm/d/yy', eg '12/25/10', or '4/1/10' (1st April) Output - Date object
我正在处理日期。 js和date.format.js,因此有Date.fromString()和Date.format()可用。但是尝试多种组合并不能满足我的需要。
I'm working with date.js and date.format.js so have Date.fromString() and Date.format() avaiable. But trying multiple combinations is not giving me what I need.
如果日期是 mm / dd / yy,那很简单。但是我使用的是jquery.datepicker.js,它以'm / d / yy'输出,我不想改变太多,我知道可以完成转换。
IF the date were 'mm/dd/yy' then it's simple. But I'm using jquery.datepicker.js which outputs in 'm/d/yy' and I don't want to change this much I know this conversion can be done.
一天22小时之后...我需要帮助。
After a 22 hour day... I need help.
谢谢。
马克。
推荐答案
使用datejs Date.parse
函数
use the datejs Date.parse
function
这篇关于Javascript字符串到日期的转换-简单吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!