Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.

Validate date and time

Log in to subscribe to topics and get notified when content changes.

Validate date and time

To validate the input of all date/time fields, you can use the following in a validation script (System Definition > Validation Scripts).

Because the date/time format is hardcoded in this script, it must match your instance's date/time format. If your instance's date/time format changes, you must update your validation script.

Set the validation script's type to "glide_date_time". Then, with this validation script, if a user enters an incorrect format in a date/time field, they will receive an error message.
function validate (value ) { if ( !value ) { return true ; } return (getDateFromFormat (value , 'yyyy-MM-dd HH:mm:ss' ) != 0 ) ;
 
 }
Figure 1. Date/time validation
Feedback