function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JBabuJBabu 

To assign today's date to a date variable

Hi,

 

I have a date variable called start_date and I am trying to assign today's date to it like below in apex class:

 

start_date = today();

 

I am getting the below issue:

 

Error: Compile Error: Method does not exist or incorrect signature: today().

 

Please let me know what is the way to get this.

 

Thanks,

Jagadish.

Best Answer chosen by Admin (Salesforce Developers) 
nandurinanduri

If u need the date use ---------------- System.today();

if u need the date and time use --- System.now();

All Answers

nandurinanduri

If u need the date use ---------------- System.today();

if u need the date and time use --- System.now();

This was selected as the best answer
JBabuJBabu

Thank you Nanduri...