You need to sign in to do that
Don't have an account?
arishi0
Compare two datetimes to validate if they are same (to the minute)
Hello,
I have to make a comparison in an if statement that takes two date time field values (Say , createdDate and LastModifiedDate) from two different records. These are values from Historical tables taht track field changes so in essence I am trying to see if tw ofield changes on these two records were made in the same minute.
So need a way to take these two date times from these records and see if they have been edited/created within the same minute.
May be an easy fix but I cannot find anything in DateTime documentation.
Thank You.!
arishi0,
You can use the Datetime.getTime() method to get the time represented in milliseconds. You can perform getTime() on both fields, get the difference between the two fields, and compare if the difference is greater than 60,000 (1 minute).