1

I downloaded the javascript and required css files from http://trentrichardson.com/examples/timepicker/

I am getting the date and time but it is in a 24hr format and I want it to be in a 12 hr format with am/pm.

I tried this:

$('.emltdp-emltd-test').datetimepicker({
    timeFormat: 'hh:mm tt',
});

but its not working.

JDB
  • 25,172
  • 5
  • 72
  • 123
freak007
  • 88
  • 9
  • You may find your answer here: http://stackoverflow.com/questions/8847109/formatting-the-date-time-with-javascript – Dwight David Desotelle Jr. Apr 02 '15 at 14:21
  • @DwightDavidDesotelleJr. - The OP is asking for helping using a specific jQuery widget library. The post you've linked to has nothing to do with the library in the question. – JDB Apr 02 '15 at 14:28
  • [From the OP](http://stackoverflow.com/questions/29414219/time-format-not-working-for-datetimepicker/29415415#comment47026219_29415415): "*Thanks #JDB I forgot to add something. :)*" – JDB Apr 07 '15 at 02:31

1 Answers1

0

I don't see anything wrong with your code, and I can verify that it should work if it matches what you've posted. Just make sure you don't have any spelling or capitalization mistakes in your actual code.

$(function(){

  $('.emltdp-emltd-test').datetimepicker({
    timeFormat: 'hh:mm tt',
  });

})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/themes/smoothness/jquery-ui.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
<script src="http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js"></script>
<link rel="stylesheet" href="http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.css" />

<input class="emltdp-emltd-test" />
JDB
  • 25,172
  • 5
  • 72
  • 123