Hi,
I have some XML data which contains a date in dd/mm/yyyy format (ie UK date format).
In javascript I need to read this date then calculate the age (in days& decimals) of the XML data.
I can get today's date in milliseconds:
but I can't see how to read the XMLdate in UK format, I have the XML date (string) in a var called docdate & I thought this should work:
Then I can sutract date1_ms from date2_ms to get the age in milliseconds, but the Date.parseStrin g(docdate,"d/M/yyyy"); doesnt work. and my alternative of:
var date2=Date/parse(docdate." d/M/yyyy")
ignores my format command and reads the date as US format.
Can any one give me the correct line oif code, or a better one:-) or point me to a reference. Everything I;ve found formats the date for OUTPUT rather than INPUT.
Thanks.
I have some XML data which contains a date in dd/mm/yyyy format (ie UK date format).
In javascript I need to read this date then calculate the age (in days& decimals) of the XML data.
I can get today's date in milliseconds:
Code:
var current_date = new Date(); var date1_ms = current_date.getTime();
Code:
var date2 = Date.parseString(docdate,"d/M/yyyy"); var date2_ms = date2.getTime();
var date2=Date/parse(docdate." d/M/yyyy")
ignores my format command and reads the date as US format.
Can any one give me the correct line oif code, or a better one:-) or point me to a reference. Everything I;ve found formats the date for OUTPUT rather than INPUT.
Thanks.
Comment