How to find whether two dates are same using apex in Salesforce?

Sample Code:
DateTime:
datetime myDate = datetime.now();
datetime dueDate = 
datetime.newInstance(2008, 1, 30);
boolean dueNow = myDate.isSameDay(dueDate);//return true if myDate and dueDate are same else return false

Date:
date myDate = date.today();
date dueDate = date.newInstance(2008, 1, 30);
boolean dueNow = myDate.isSameDay(dueDate);//return true if myDate and dueDate are same else return false

Cheers!!!

No comments:

Post a Comment