bambinou1980 Posted August 5, 2015 Share Posted August 5, 2015 Hello all, I have a form that required a time picker, with a bit of searching I found something called Moment.js and boostrap 3 timepicker from here: https://eonasdan.github.io/bootstrap-datetimepicker/Installing/ I have installed all the dependencies via bower and everything is in place, the time picker is also showing. Where I am confused: 1)How to keep the value of the timepicker and set it as "value" in this field: <div class="form-group"> <div class='input-group date' id='datetimepicker1'> <input type='text' class="form-control" value="" /> <span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> <script type="text/javascript"> $(function () { $('#datetimepicker1').datetimepicker(); }); </script> The time picker is showing: MM/DD/YYYY but I need it: DD/MM/YYYY Could you please give me a quick example on how to play with this time picker? I just need to record the data and send it to mysql. Thank you! Ben Quote Link to comment https://forums.phpfreaks.com/topic/297653-need-a-time-picker-for-my-php-project/ Share on other sites More sharing options...
Solution Ch0cu3r Posted August 6, 2015 Solution Share Posted August 6, 2015 (edited) 1)How to keep the value of the timepicker and set it as "value" in this field: Set the value attribute for the input field to your date value, examples <input type='text' class="form-control" value="05/09/2015" /> <input type='text' class="form-control" value="<?php echo $your_date_variable_here" /> To format the date to use $('#datetimepicker1').datetimepicker({ format: 'DD/MM/YYYY', }); if you still want the the time then append the format string with ' HH:mm:ss' (without the quotes) Edited August 6, 2015 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/297653-need-a-time-picker-for-my-php-project/#findComment-1518137 Share on other sites More sharing options...
bambinou1980 Posted August 8, 2015 Author Share Posted August 8, 2015 Thank you so much! Ben Quote Link to comment https://forums.phpfreaks.com/topic/297653-need-a-time-picker-for-my-php-project/#findComment-1518255 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.