Thursday, October 01, 2009

Comment about stunner's blog regarding converting date/time values to or from XML

After reading stunnware’s post Converting date/time values to or from XML, I would like to point out here, as stunnware doesn't provide comment feature, that CRM has already provided such functions in its date.js file, which you can use out of box without reinventing the wheel.

To convert a JavaScript Date object into UTC format string, you can simply use FormatUtcDate:
var date = new Date();
FormatUtcDate(date);

To convert an XML date string to a JavaScript Date object, you can use ParseDate function, which is the function that I used in my CRM JavaScript Service Helper:
ParseDate(str);

CRM platform is supposed to translate the string correctly based on the user’s timezone settings.

No comments:

Post a Comment