This course is currently a work in progress. Please join the waitlist to receive regular updates.
Current date in apex
Apex provides a built in function to get the current date of the logged in user. The system.today()
returns the current date in the users timezone.
System.today method in apex can be used to:
- Find the date according to the users time zone
- Date without time component
- Comparing two dates
How to use system.today()
Following is a sample code to find the current date in apex.
Loading...
In the above example:
- The keyword
Date
is used to declare a Date variable. - The variable name
today
is used to store the date value.