views:

61

answers:

1

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

A: 

use the datejs Date.parse function

z33m
Definitely something I looked at yesterday, however its not doing much for me. I've changed the format to MM/DD/YY now hoping that would help and now I get:var d = date.fromString(date); var e = Date.parse(date);date = '4/29/11'e = -1851750000000d = (Date) 4th May 2011Something is weird here. This is not *that* difficult..
Mark White
Changed Date.format to 'mm/dd/yy' and the date is now converted using fromString correctly.
Mark White