Avatar of Bob Schneider
Bob SchneiderFlag for United States of America

asked on 

Bootstrap Datepicker

I have a side that uses bootstrap.  I want a simple datepicker utility to allow the end user to select a date near the current date by clicking in the text form.  What is the easiest way to implement this please?

Thanks!
jQueryBootstrap

Avatar of undefined
Last Comment
Bob Schneider
SOLUTION
Avatar of David H.H.Lee
David H.H.Lee
Flag of Malaysia image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Bob Schneider

ASKER

Thank you both.  What about just date...without time?
SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
SOLUTION
Avatar of lenamtl
lenamtl
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Bob Schneider

ASKER

Thanks so much!  I am getting back to this now.  Since I am already using Bootstrap 4, if I were to use the code provided by David H. H. Lee, which references Scott's example, what do I need to make this work besides just the code provided by David?

Thanks for your patience!  I wish I would have really honed in on js years ago when I first started this jopurney...
Avatar of Bob Schneider

ASKER

For claraification, I added this to the head section:
    <script type="text/javascript">
        $(".form_datetime").datetimepicker({format: 'yyyy-mm-dd hh:ii'});
    </script> 

Open in new window


And this to the body section:
                        <fieldset class="form-group position-relative has-icon-left">
                            <label for="dtp_input2" class="col-md-2 control-label">Date: </label>
                            <div class="input-group date form_date col-md-5" data-date="" data-date-format="dd MM yyyy" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
                                <input class="form-control form_datetime" size="16" type="text" name="this_date" id="this_date" value="<%=dThisDate%>">
                                <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>        </span>
                            </div>                            
                            <!--<input type="text" class="form-control" 
                            name="this_date" id="this_date" placeholder="Select Date" 
                            value="<%=dThisDate%>" required="">
                            -->
                        </fieldset>

Open in new window

SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Bob Schneider

ASKER

Thanks Scott!  Between this and the Modal I am working on I'm learning things I need to know.  this is such a helpful site!
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

I get it and have been there.  

Take an hour break from asp coding each day for a week and go through 2 or 3 courses each day over at https://www.codecademy.com/learn/introduction-to-javascript.  Some of this you may know already, but start at the beginning anyway. There are 9 units for JS  so a week is a good time.  What I like is it is not watching a video and instead, learning by writing code a little bit at a time.  JQuery evolved as an easier way to write javascript at a time when javascript was not was easy to manipulate the page. Today it is a different and Jquery is/has fallen in popularity. Pure JS or React/Vue/Angular are what is taking over for front end.

It would be a good to take some time to go through the basic js course as a refresher.
Avatar of Bob Schneider

ASKER

Good advice Scott!  I will definitely do that!
jQuery
jQuery

jQuery (Core) is a cross-browser JavaScript library that provides abstractions for common client-side tasks such as Document Object Model (DOM) traversal, DOM manipulation, event handling, animation and Ajax. jQuery also provides a platform to create plugins that extend jQuery's capabilities beyond those already provided by the library.

19K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo