views:

21

answers:

1

Hi Guys, i made this code for inserting data to an system mail that know to work with xml file. the problem is that i try to create some javascript code for getting the current date of day, and then put it inside the filed date, but without success.

i know hot create the date in javascript, my problem is in thx xml file, i mean how can i impplemt the date inside the filed date in the xml file.

the code(xml side):

123456

NOW COMPLETE ENGLISH

1274 liran **

413 3280 86308 ; UNIX email;dateofday [email protected];(i want here to return the date from the javascript)

thanks,

+1  A: 

I'm not sure I understand, but you can use getTime() on your Date objec to insert it into the XML file as milliseconds, and if you need to convert it back into a JavaScript object you can parse it directly.

function putInXmlFile(d) {
  writeToXML(d.getTime());
}

function getFromXmlFile() {
  var date = new Date(getFromXML());
}

It works because the JavaScript Date object can parse from the milliseconds from the epoch (which is returned by getTime).

EMMERICH