+ Start a Discussion
stollmeyerastollmeyera 

Getting Todays Date - THIS IS EATING AWAY AT ME!!

This is such a simple idea and it is killing me that I can't figure it out.  I have APEX in place that automatically creates a campaign.  What I am trying to do is get todays date and extract the year into the name of a campaign.  In othewords, I want the campaign name to read "YYYY - Campaign Name".

 

I would love to see some documentation on this, but I can't find anything regarding APEX methods.  Can someone please help me??  

Best Answer chosen by Admin (Salesforce Developers) 
TejTej

Integer currentYear = datetime.now().year();

system.debug( 'Current Year------>'+currentYear );

myCampaign = currentYear+campaignName;

 

Thanks.

TEJ

All Answers

TejTej

Integer currentYear = datetime.now().year();

system.debug( 'Current Year------>'+currentYear );

myCampaign = currentYear+campaignName;

 

Thanks.

TEJ

This was selected as the best answer
stollmeyerastollmeyera

I must be a compete idiot because I actually stumbled upon those docs and didnt think much of them.  Was able to figure it out tho.  

 

Thanks for the help, all.