no space between date and time using jquery-ui date/time picker
hi i have a jquery date/time picker.. my problem is that it is displayed in
2011-05-045:36 PM
and i need help on how to do it as
2011-05-04 5:36 PM
i know its very easy for you guys but i cant really make it to work. please help me.
code:
<script>
date_obj = new Date();
date_obj_hours = date_obj.getHours();
date_obj_mins = date_obj.getMinutes();
if (date_obj_mins < 10) { date_obj_mins = "0" + date_obj_mins; }
if (date_obj_hours > 11) {
date_obj_hours = date_obj_hours - 12;
date_obj_am_pm = " PM";
} else {
date_obj_am_pm = " AM";
}
date_obj_time = "'"+date_obj_hours+":"+date_obj_mins+date_obj_am_pm+"'";
$(function() {
$( "#regdate" ).datepicker({
dateFormat: $.datepicker.ISO_8601 + date_obj_time,
});
});
</script>
html:
<div class="field"><label for="regdate">Registration Date </label> <input id="regdate" name="regdate" si开发者_如何学运维ze="20" type="text" class="large" /></div>
I'm not sure, but would this work?
date_obj_time = "'"+" "+date_obj_hours+":"+date_obj_mins+date_obj_am_pm+"'";
It looks like just adding in another space in your string should fix that. Hope it helps. EDIT: whoops, didn't see the comments.
精彩评论