---
sourceDocument: Yokohama Build or modify applications
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/yokohama/application-development

 Release :

    - yokohama

ft:locale :

    - en-US

ft:publication_title :

    - Yokohama Build or modify applications

ft:clusterId :

    - cadev

bundleId :

    - cadev

workflow :

    - Development, Data, and Analytics


---

# Validation script use case - Date and time

# Validation script use case - Date and time {#ariaid-title1}

* Release version: Yokohama
* 
* Updated February 6, 2025
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

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

Because the date/time format is hard-coded 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);
    }

For a comprehensive use case, see [Restricting record access](https://www.servicenow.com/docs/access?context=c_ExScptDftBfrQryBsnRu&version=yokohama&pubname=yokohama-api-reference&ft:locale=en-US).

*[\>]: and then


