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

How to set the date format to dd-MMM-yyyy

Hi,
 I am using the syncfusion datepicker to display date of birth of user in my form. I want to display the date format as dd-MMM-yyyy(5-Feb-2015) in the view and input. I am working with angularjs and written code in html file as,

<input id="datepick" class="col-md-8 col-lg-8" ej-datepicker  e-value="employee.birthdate" e-format="{0:dd-MMM-yyyy}" ej-change="changeformat()" e-enableStrictMode="true" />

To display date to view, i have used {{employee.birthdate | date: "dd-MMM-yyyy"}} 

In js file, I have included,

 $scope.changeformat = function () {

        $scope.employee.birthdate = $filter('date')($scope.employee.birthdate, "dd MMM yyyy");
    };
But, the above code is not working. It is still displaying the date in 3/2/2015 format. How can i change the date format to dd-MMM-yyyy  using angularjs?

Thank you.

5 Replies

HP Harikrishnan P Syncfusion Team March 6, 2015 06:30 AM UTC

Hi Tejaswini,

Thanks for using  Syncfusion products.

Query : How to set the date format to dd-MMM-yyyy

We would like to inform you that, for specifying date format we need to use the property ‘e-dateformat’. On analysing your code, it is found that you have mentioned as ‘e-format’ while declaring the datepicker. Please use the code as shown below to resolve your issue.

<input id="datepick" class="col-md-8 col-lg-8" ej-datepicker  e-value="dateValue" e-dateformat="dd-MMM-yyyy" e-change="changeformat()" e-enableStrictMode="true" />

You can refer the following common user guide for JavaScript to know more about getting started with our components. Under each components we have provided “Concepts and features” section which explains about the features of the particular component.

http://help.syncfusion.com/web

You can also refer the following class reference link for JavaScript, which showcases all the properties, methods and events supported by each component.

http://help.syncfusion.com/cr/js

Please let us know if you have further queries.

Regards,

HariKrishnan




TE Tejaswini March 10, 2015 04:37 AM UTC

Thank you Harikrishanan. The e-dateformat works correct.


SN Sasikala Nagarajan Syncfusion Team March 12, 2015 03:38 AM UTC

Hi Tejaswini,
Thanks for the udpate.

Please get back to us if you need further assistance. We will be happy to help you out.

Regards,

Sasikala Nagarajan




JG Jony Green September 4, 2015 03:59 AM UTC

I use this online service to format my js code, it's free.



HP Harikrishnan P Syncfusion Team September 7, 2015 10:33 AM UTC

Hi Jony,

Thanks for your suggestion. If you need any assistance regarding our components, please get back to us and we will be happy to help you.

Regards,
HariKrishnan

Loader.
Up arrow icon