function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sachin P Sam 1Sachin P Sam 1 

How to set validation on Date/Time Field?

I need to ensure that the value in date/time should be betweeen 9 am and 9pm,how can i restrict other values, using validation rules.
Please Help.
Thanks in advance,
samyuktha reddy etikayalasamyuktha reddy etikayala
Hi Sachin,

Please find below code:

Time Portion = 
MID ( TEXT (My_Datetime__c ), 9, 9)

If its helpful for you, choose as best answer, further it can be helpful for other friends.

Thanks and regards,
Sachin P Sam 1Sachin P Sam 1
@samyuktha reddy etikayala,
i am using it in validation rule.
What is the Time portion there