Working with dates in CRM

Working with dates in CRM

Being that CRM works with a few diffrerent languages, and its own context language; programming can sometimes be a little tricky

The following script uses:

eWare record object
eWare Query Object
Java DateScript and
SQL data updates…

I have posted this as it took hours to work out and hopefully it will help someone in the future….

record = eWare.FindRecord(“charaction”, “char_charactionid=”+UseId);
actiondate = new Date(record.item(‘char_actioneddate’));
sql = “update charaction set char_tobeactioned = DateAdd(d,90,’”+actiondate.getYear()+”/”+actiondate.getMonth()+”/”+(actiondate.getDate()+1)+ “‘) where char_order=5 and char_chartid=”+ chartid;
Query=eWare.CreateQueryObj(sql);
  Query.ExecSql()

A more detailed explanaition can be found at

http://dpp.sagecrm.com/blogs/hints_tips_and_tricks/archive/2009/07/10/useful-date-functions.aspx

About the Author

John Waters (Director of Accounting Software Professionals) attained his IT and Accounting skills during the years when accounting systems were in their infancy. Spotting a niche in his chosen proefession as a Chartered Accountant, he has created a brand and breed of CA that bridges the gap between management needs and IT deliverables.