admin管理员组文章数量:1023639
I'm using Bootstrap 3 datetimepicker in rails app. Here is my js file:
$(function() {
$('#datetimepicker').datetimepicker();
});
And I need to reformat date type into Year-Month-Day Time
I've tried
$(function () {
$('.datetimepicker').datetimepicker({
format: 'yyyy-mm-dd H:i'
});
});
But after adding format line script doesn't work. Any ideas?
UPD
</div>
<div class="form-group">
<%= label_tag :start_time, 'StartTime' %>
<div class="input-group date" id="datetimepicker">
<%= text_field :start_time, nil, class: 'form-control' %>
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
</div>
</div>
here is using
I'm using Bootstrap 3 datetimepicker in rails app. Here is my js file:
$(function() {
$('#datetimepicker').datetimepicker();
});
And I need to reformat date type into Year-Month-Day Time
I've tried
$(function () {
$('.datetimepicker').datetimepicker({
format: 'yyyy-mm-dd H:i'
});
});
But after adding format line script doesn't work. Any ideas?
UPD
</div>
<div class="form-group">
<%= label_tag :start_time, 'StartTime' %>
<div class="input-group date" id="datetimepicker">
<%= text_field :start_time, nil, class: 'form-control' %>
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
</div>
</div>
here is using
Share Improve this question edited May 30, 2015 at 9:22 Damir Nurgaliev asked May 30, 2015 at 8:39 Damir NurgalievDamir Nurgaliev 3615 silver badges20 bronze badges 1- try it as follows: $('#datepicker').datetimepicker({ format:'d.m.Y H:i' }); – Adnan Devops Commented May 30, 2015 at 8:44
3 Answers
Reset to default 3It worked for me as follows:
$('#datetimepicker').datetimepicker(
format: 'YYYY-MM-DD HH:mm'
)
You have to specify the dateFormat and timeFormat differently. Below is the code for reference:
$('#datetimepicker').datetimepicker({
dateFormat: "yy-mm-dd",
timeFormat: "HH:mm"
});
Both of the answers for this question didn't work for me. But this worked:
$('#datetimepicker').datetimepicker({
format: 'YYYY-MM-DD HH:mm'
})
I'm using Bootstrap 3 datetimepicker in rails app. Here is my js file:
$(function() {
$('#datetimepicker').datetimepicker();
});
And I need to reformat date type into Year-Month-Day Time
I've tried
$(function () {
$('.datetimepicker').datetimepicker({
format: 'yyyy-mm-dd H:i'
});
});
But after adding format line script doesn't work. Any ideas?
UPD
</div>
<div class="form-group">
<%= label_tag :start_time, 'StartTime' %>
<div class="input-group date" id="datetimepicker">
<%= text_field :start_time, nil, class: 'form-control' %>
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
</div>
</div>
here is using
I'm using Bootstrap 3 datetimepicker in rails app. Here is my js file:
$(function() {
$('#datetimepicker').datetimepicker();
});
And I need to reformat date type into Year-Month-Day Time
I've tried
$(function () {
$('.datetimepicker').datetimepicker({
format: 'yyyy-mm-dd H:i'
});
});
But after adding format line script doesn't work. Any ideas?
UPD
</div>
<div class="form-group">
<%= label_tag :start_time, 'StartTime' %>
<div class="input-group date" id="datetimepicker">
<%= text_field :start_time, nil, class: 'form-control' %>
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
</div>
</div>
here is using
Share Improve this question edited May 30, 2015 at 9:22 Damir Nurgaliev asked May 30, 2015 at 8:39 Damir NurgalievDamir Nurgaliev 3615 silver badges20 bronze badges 1- try it as follows: $('#datepicker').datetimepicker({ format:'d.m.Y H:i' }); – Adnan Devops Commented May 30, 2015 at 8:44
3 Answers
Reset to default 3It worked for me as follows:
$('#datetimepicker').datetimepicker(
format: 'YYYY-MM-DD HH:mm'
)
You have to specify the dateFormat and timeFormat differently. Below is the code for reference:
$('#datetimepicker').datetimepicker({
dateFormat: "yy-mm-dd",
timeFormat: "HH:mm"
});
Both of the answers for this question didn't work for me. But this worked:
$('#datetimepicker').datetimepicker({
format: 'YYYY-MM-DD HH:mm'
})
本文标签: javascriptBootstrap3 datetimepicker DATE format railsStack Overflow
版权声明:本文标题:javascript - Bootstrap3 datetimepicker DATE format rails - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745566263a2156465.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论