jQuery UI datetimepicker change date & time format showed in text

19,492
<script type="text/javascript">
    $(function(){  

       // $("#datepicker").datepicker();
        $("#datepicker").datetimepicker(
                {
                    changeMonth: true,
                    changeYear: true,
                    timeFormat: 'hhmm',
                    showSecond: false,
                    dateFormat:'ymmdd',
                    separator: ''
                });


        //$('#datepicker').datetimepicker({
            //altField: "#alt_example_4_alt",
            //altFieldTimeOnly: false ,
            //timeFormat: 'hhmm' ,
            //dateFormat:'ymmdd'
        //});

    });


</script>
Share:
19,492
user1479057
Author by

user1479057

Updated on June 26, 2022

Comments

  • user1479057
    user1479057 almost 2 years

    jQuery: http://trentrichardson.com/examples/timepicker/

    After user change time, text field showed as 20120625 122900.

    I would like to change the format for 20120625122900, without space between date and time.

    Can anyone provide a good way to show the format which I want?

  • user1479057
    user1479057 almost 12 years
    Thanks a lot! After I change that, it's display the format which I want.
  • Bilal
    Bilal almost 9 years
    Add single qoutes instead double and test --- Check this jqueryui.com/resources/demos/datepicker/date-formats.html