I have a requirement where i have to enter some date for example 12-15-2014 and there is already start date (11-01-2014) and end date (12-31-2014) in system. So, i have to find whether user entered date (12-15-2014) is falling in between start date and end date or not. How can i achieve this functionality using apex?

1 Answer 1


Well I guess same way as any language, compare them ;)

something like

Date startDate = *start date*; Date endDate = *end date*; Date userDate = *user date*;

if(userDate > startDate     &&  userDate  < endDate ){   // do something }

But I still have feeling you question wasn't specific enought...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.