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
Jyoti Singh 9Jyoti Singh 9 

Get current date in Apex

How do I get the current date in Apex?
Best Answer chosen by Jyoti Singh 9
Gaurav KheterpalGaurav Kheterpal
Simply use the Date class like this
 
Date todaysDate = system.today();
I hope this helps.

If my answer helps resolve your query, please mark it as the 'Best Answer' to benefit others and improve the overall quality of Discussion Forums.
 

All Answers

Gaurav KheterpalGaurav Kheterpal
Simply use the Date class like this
 
Date todaysDate = system.today();
I hope this helps.

If my answer helps resolve your query, please mark it as the 'Best Answer' to benefit others and improve the overall quality of Discussion Forums.
 
This was selected as the best answer
Jyoti Singh 9Jyoti Singh 9
Thank you!