Javascript string to Date conversion - simple?

Posted by Mark White on Stack Overflow See other posts from Stack Overflow or by Mark White
Published on 2010-04-04T04:37:15Z Indexed on 2010/04/04 4:43 UTC
Read the original article Hit count: 495

Filed under:
|
|

Hi all,

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.

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...

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about date