+ Start a Discussion
Rodelio SantosRodelio Santos 

Date Validation on First Week of the Next Month

Hello,

I have a field Charging_Date__c..

Thru front-end validation rule, can i create a validation rule using that will raise an error message if the date entered is not on the first week of the next month?

Or this should be done somewhere else apex?

thanks,
Del
sandeep sankhlasandeep sankhla
Hi

Yes we can validate the date..if date format is fix then we can parse the date and get the day , date and month..

Then based on today's date we can get the day, date and month...

Then we can compare them adn get the result which you need...

Just for a reference see below code  for validation of date
http://www.w3resource.com/javascript/form/javascript-date-validation.php

Entire code is not needed, only you see how to parse specifc format
ex:if date entered is mm/dd/yy and it is fix then you can split by / and get mm,dd,yy and then you can compare them...

Please check and let me know if you need anything else

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.

Thanks,
Sandeep
Salesforce Certified Developer 
SteveMoSteveMo
Are you including dates from the end of the current month in the first week of the next month?  For example the First week of May 2015 will include April 26-30