开发者

Javascript string to Date conversion - simple?

Yesterday I managed to solve this, then lost a day's work due to开发者_StackOverflow中文版 the death of a HD. Now I cannot remember what I did to fix it, but I know it can be done.

Input: string date in the format 'm/d/yy', eg '12/25/10', or '4/1/10' (1st April) Output - Date object

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.

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.

After a 22 hour day... I need help.

Thanks.

Mark...


use the datejs Date.parse function

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜