How do I format date in jQuery datetimepicker

0 votes

I use jQuery datetimepicker which was extended from jQuery datepicker to pick not only date but time too.

I want to set date/time format this way: dd-mm-yyyy @ hh:mm

$('#timePicker').datetimepicker({
  dateFormat: 'dd:mm:yyyy',
  separator: ' @ ',
  minDate: new Date()
});

But this does not work. I get date/time in following format:

Thu Jan 27 2011 02:05:17 GMT+0100

Is there any javascript function to format this date/time? If not how do I do that using the plugin? Check out my code: FIDDLE

Jun 3, 2022 in JQuery by Edureka
• 13,690 points
20,339 views

1 answer to this question.

0 votes

jquery datepicker format” Code Answer's

  1. $('#timePicker'). datetimepicker({
  2. // dateFormat: 'dd-mm-yy',
  3. format:'DD/MM/YYYY HH:mm:ss',
  4. minDate: getFormattedDate(new Date())
  5. });
  6. function getFormattedDate(date) {
  7. var day = date. getDate();
answered Jun 3, 2022 by Edureka
• 13,690 points

Related Questions In JQuery

0 votes
1 answer

How do I format date in jQuery datetimepicker?

d - Day of the month. ddd - ...READ MORE

answered Jun 28, 2022 in JQuery by rajatha
• 7,680 points
939 views
0 votes
1 answer

How do I pre-populate a jQuery Datepicker textbox with today's date?

Hello @kartik, You must FIRST call datepicker() > then use ...READ MORE

answered May 29, 2020 in JQuery by Niroj
• 82,840 points
12,237 views
0 votes
1 answer

How do I check if the mouse is over an element in jQuery?

Hello @kartik, Use this code: $("someelement").mouseenter(function(){ ...READ MORE

answered Oct 5, 2020 in JQuery by Niroj
• 82,840 points
2,369 views
0 votes
1 answer

How do I check if file exists in jQuery or pure JavaScript?

Hello @kartik, With jQuery: $.ajax({ url:'http://www.example.com/somefile.ext', ...READ MORE

answered Oct 5, 2020 in JQuery by Niroj
• 82,840 points
6,542 views
0 votes
1 answer

How do I format date in jQuery datetimepicker?

“jquery datepicker format” Code Answer's $('#timePicker'). datetimepicker({ // dateFormat: ...READ MORE

answered Jun 10, 2022 in JQuery by rajatha
• 7,680 points
632 views
0 votes
1 answer

What is jQuery?

Hey, jQuery is a fast and concise JavaScript ...READ MORE

answered Feb 14, 2020 in JQuery by kartik
• 37,520 points
1,347 views
0 votes
1 answer

Uncaught TypeError: Cannot read property 'msie' of undefined - jQuery tools

Hello, Use the following script tag in your ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,840 points
15,871 views
0 votes
1 answer

Uncaught Error: Bootstrap's JavaScript requires jQuery

Hello @kartik, You have provided wrong order for ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,840 points
23,376 views
0 votes
1 answer

How do I format date in jQuery datetimepicker?

jquery datepicker format” Code Answer's $('#timePicker'). datetimepicker({ // dateFormat: ...READ MORE

answered Jun 3, 2022 in JQuery by Edureka
• 13,690 points
1,305 views
0 votes
1 answer

How do you make an element "flash" in jQuery

If all you want is that yellow ...READ MORE

answered Jun 1, 2022 in JQuery by Edureka
• 13,690 points
2,423 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP