Thursday, March 15, 2012

Entering a Specific Date in APEX

I was trying to assign a calendar date like this

q2.Calendar_Date__c = '03-14-2012';

That doesn't work! You have for create a new Date Instance like this....

q2.Calendar_Date__c = date.newInstance(2011, 03, 14);


This is the board the I found this on: (Thank you Bob Buzzard!)

http://boards.developerforce.com/t5/Apex-Code-Development/Date-Variable/m-p/197399/highlight/true#M33430

No comments:

Post a Comment