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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Syncfusion Feedback

How to change the culture of the DatePicker control based on the browser language?

Platform: jQuery |
Control: ejDatePicker
Tags: javascript

You can set the localization for Syncfusion controls like TextBoxes, DatePicker, etc. based on the browser culture by using the locale property. There is an in-built method called the ej.browserInfo () that returns the browser information as an object.  Then, pass this culture information to the locale property of the components. Refer to the following code example that demonstrates the same.


        $(function () {
                value: new Date(),
                // Gets the browser culture name.
                locale: ej.browserInfo().culture.name


In the code, ej.browserInfo().culture.name is specified as the value for the locale property. Now, DatePicker control culture is set based on the browser culture. You can also set the browser culture to the controls dynamically by using their instance, as given in the following code example.


            //Creates an object for the DatePicker control.
            obj = $("#datepick").data("ejDatePicker");
            // Sets the locale to the control dynamically.
            obj.option("locale", ej.browserInfo().culture.name);


To apply a different culture to the components other than the English culture, include the corresponding culture file. So, based on the browser culture, include the corresponding culture file in the application. The globalize.cultures.js is a combined script file for all the cultures, and includes all the culture-related files.

Sample Links:

For globalize.culture.js: https://ajax.aspnetcdn.com/ajax/globalize/0.1.1/cultures/globalize.cultures.js

For online documentation: https://help.syncfusion.com/js/localization

You must log in to leave a comment

Please sign in to access our KB

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

Up arrow icon

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

Live Chat Icon For mobile