Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

deepu07's avatar
Level 11

How to enable bootstrap-jquery datetimepicker

Here I'm trying to use bootstrap-jquery datetimepicker for my form. but unfortunately I'm getting an error that datetimepicker undefined function. here is my code `

 <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.7.1/css/bootstrap-datepicker.min.css" rel="stylesheet"/>
 <script src="http://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker.js"></script>

 <script type="text/javascript">
 $('#date').datetimepicker({
   todayHighlight: true,
   format: 'dd/mm/yyyy',
   startDate: new Date()   
  });
 </script>```

Uncaught TypeError: $(...).datetimepicker is not a function

Any help that would be appreciated. Thanks in advance 
0 likes
11 replies
Cronix's avatar

Ok, but you're using a date picker, not a datetime picker.

<script src="http://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker.js"></script>

The plugin is called "datepicker", so you're loading the wrong plugin. Which is why you're getting the Uncaught TypeError: $(...).datetimepicker is not a function error because "datetimepicker" doesn't exist.

You probably want this one: https://eonasdan.github.io/bootstrap-datetimepicker/

deepu07's avatar
Level 11

@Cronix But I'm using in composer not npm. There is no installion process for composer ;)

Cronix's avatar

So download it from github (there's a link to the repo in the upper-right corner for github) and include it normally. Usually composer is for php packages, not javascript. npm is for javascript.

https://eonasdan.github.io/bootstrap-datetimepicker/Installing/#manual

That said, I simply went to packagist.org and searched for "bootstrap-datetimepicker" and easily found it, so you can use composer to install it. Why it's on packagist, I don't know.

You'll need to figure it out as I'm not using that plugin. But I answered your question on why you're getting the error.

deepu07's avatar
Level 11

@Cronix for that. I'm using this datetimepicker laravel So that's what I' confusing. Anyway thanks man.

Cronix's avatar

You're welcome. Please mark the post as solved.

deepu07's avatar
Level 11

It didn't solved @Cronix see my post title I wanna enable the datetimepicker.

Cronix's avatar

So load the right plugin. Do you need step by step instructions, or can you read the docs? I've linked to them, and even said it was on packagist (you could have easily searched there too) so you can just go there and search for it and install it via composer. What more do you want? Have you actually tried anything that I said?

jlrdw's avatar

Is there any code where you are actually using it, like:

<input type='text' class="form-control" id='datetimepicker4' />

And where is you beginning code, like

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

////// your date code goes here

});
</script>

@Cronix it appears OP has had no basics in JS.

Please or to participate in this conversation.