Date and Date time in Salesforce

Date:
Date dat = System.today();  //Returns today's date
Date dt = dat.addDays(2);  // Returns day after tomorrow's date

Datetime:
Datetime dt = System.now();  // Returns current date and time
Datetime dt1 = dt.addHours(2);  // Returns 2 hours ahead of current date and time 

No comments:

Post a Comment