We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set the control to 24-hour system?

Thread ID:

Created:

Updated:

Platform:

Replies:

142795 Feb 20,2019 06:31 AM UTC Feb 20,2019 09:50 AM UTC ASP.NET Core - EJ 2 3
loading
Tags: DateTime Picker
pomelobutter
Asked On February 20, 2019 06:31 AM UTC

hi,How to set the control to 24 hours and add the onchange method to this control, I have to do some validation in js

Deepa Loganathan [Syncfusion]
Replied On February 20, 2019 07:14 AM UTC

 
Hi Pomelobutter,  
 
Thanks for contacting Syncfusion support.  
 
You can set the Time display format and capture Change event of Datetimepicker with the timeDisplayFormat API and Change event of Datetimepicker respectively. This is depicted in the below code. 
 
 
<ej-date-time-picker id="dtp" time-display-format="HH:mm" change="validate"></ej-date-time-picker> 
 
 
<script> 
    function validate() { 
        console.log("DateTimepicker value selected"); 
    } 
</script> 
 
 
Note: The timeDisplayFormat will override the format given in dateTimeFormat. 
 
Please check the below help pages to explore more about the configuration options available in Datetimepicker.  
 
 
 
Validating Datetime input 
 
You can validate the value Datetime input values by using ValidationRules and ValidationMessages APIs as given in the below help link. 
 
 
Regards,  
Deepa L. 
 


pomelobutter
Replied On February 20, 2019 08:20 AM UTC

hi,I didn't use ej1, I am using ej2 now.

Deepa Loganathan [Syncfusion]
Replied On February 20, 2019 09:50 AM UTC

 
Hi Pomelobutter,   
 
Sorry for the misunderstanding.  
 
You can set the Timeformat of EJ2 Datetimepicker with timeFormat API as given in the below code.  
 
<ejs-datetimepicker id="dtp" change="Validate" timeFormat="HH:mm"></ejs-datetimepicker> 
 
<script> 
    function Validate() { 
        console.log("DateTimepicker value selected"); 
    } 
</script> 
 
Please check the below link to explore more about APIs of EJ2 Datetimepicker. 
 
 
To implement validation in Datetimepicker, we suggest using our inbuilt Form Validator. In the below help page, we have depicted the usage of Form validator with Datetimepicker.  
 
 
Please check the below API documentation to explore more about the options available in Form Validator plugin and let us know if you have any further queries. 
 
 
Regards,  
Deepa L. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;