2017  Kodetalk | Feedback | Privacy Policy | Terms | About

How to use moment js date formatter in web application?

I am looking for a solution to parse the given date into the application need format. I google and found the solution as momem.js with documentation and api. But the issue is I am little confuse how to use in my web application.

Please suggest or give some example for reference purpose. Thanks in advance.




        <title>Example of using Moment.js</title>

        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

        <script src="moment.js"></script>


            $(document).ready( function() {

                update = function() { $('#moment_date').html(moment(new Date($('#moment_date').attr('title')))

             .format('MMM DD, [at] YYYY hh:mm A z'));

            }; update();});




    Momemt Date : <span id="moment_date" title="2013-12-12T18:29:50.588Z"></span>



Answer is