You need to sign in to do that
Don't have an account?

Date Variable
I have what should be a simple question but for the life of me I can't figure it out. (Yes, I'm a newbee to Apex) :)
I have a test class that I'm working on and I need to set the date field to a specific date. Ideally, I'd like to set the date value to July 15 of the current year. How do I do this? Below is the code, that doesn't work, and the value I'm trying to set is Exp_Date__c (a date field)
Account a1 = new Account(Name='Test1', Status__c='Active', 'VCM', RecordTypeId='01280000000G1LH','00580000003DryK', Dues__c=100, Exp_Date__c=2010-07-15);
You need to construct a new instance of a date and use that:
e.g.
All Answers
You need to construct a new instance of a date and use that:
e.g.
Thank you for the quick reply. It works perfectly now. I had tried datetime.newInstance but not date.newInstance. Thanks again for your help.