Tuesday, May 21, 2013

time picker


  • id for JavaScript
  • name for PHP/Python

Datepicker
jquery-ui.js
jquery-ui.css

---
<script>
        $(function() {
            $( "#datepicker" ).datepicker({dateFormat:'M. dd, yy'});
        });
</script>



from datetime import datetime


date = request.POST['date'] #covert to date
    date = datetime.strptime(date, '%b. %d, %Y').date()  #otherwise datetime
    request.session['date'] = dates

class datetime.timedelta([days[seconds[microseconds[milliseconds[minutes[hours[weeks]]]]]]])


Sample.objects.filter(date__range=["2011-01-01", "2011-01-31"])


start = date(2012, 12, 11)
end = date(2012, 12, 18)
new_end = datetime.combine(end, time(23, 59, 59, 999999))

ExampleModel.objects.filter(some_datetime_field__range=[start, new_end])

template:

Yard-Level: Yard Planning Quality Evaluation<br>

{{ date }} <br>

<p>Time Frame: {{timeFrame}}; {{time}}</p> not correct: NAIVE



timepicker (not built-in in JQuery)

<script type="text/javascript" src="{{ STATIC_URL }}js/DatePicker.js"></script>
    <script type="text/javascript" src="{{ STATIC_URL }}js/timepicker/jquery.timepicker.js"></script>
    <link href="{{ STATIC_URL }}js/timepicker/jquery.timepicker.css" rel="stylesheet" type="text/css">

No comments:

Post a Comment