use*_*176 6 php jquery datetime jquery-ui datepicker
我正在使用jQueryUI datepicker,这是代码.
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
$( "#from" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 3,
onClose: function( selectedDate ) {
$( "#to" ).datepicker( "option", "minDate", selectedDate );
}
});
$( "#to" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 3,
onClose: function( selectedDate ) {
$( "#from" ).datepicker( "option", "maxDate", selectedDate );
}
});
});
</script>
<form action="{LINKTO_EXPORT}" method="post">
<h1>{EXPORT_CSV}</h1>
<label for="from">from</label>
<input type="text" id="from" name="from">
<label for="to">to</label>
<input type="text" id="to" name="to">
<input type="submit" value="{EXPORT_TEXT}">
</form>
Run Code Online (Sandbox Code Playgroud)
当我"发布""从"和"到"时,
$fromstr = $_POST["from"];
$tostr = $_POST["to"];
$from = date('Y-m-d H:i:s',strtotime($fromstr." 02:00:00"));
$to = date('Y-m-d H:i:s',strtotime($tostr." 02:00:00"));
Run Code Online (Sandbox Code Playgroud)
在to已正确转换,即,2015-06-13 02:00:00但from没有.它返回了6/1/2015 2:00.为了确保我获取正确的值,我回应了$fromstr和$tostr.
$fromstr返回6/1/2015
$tostr返回06/13/2015
为什么在from返回米/d/yyyy的同时to确实毫米 /日/年?如何将m/d/yyyy字符串转换为时间戳呢?请帮帮忙,谢谢!
尝试这个..
下载以下js
<link rel="stylesheet" type="text/css" href="http://xdsoft.net/scripts/jquery.datetimepicker.css"/>
<script src="http://xdsoft.net/scripts/jquery.datetimepicker.js"></script>
Run Code Online (Sandbox Code Playgroud)
不能直接使用,所以要下载js和css。
<script>
$(function() {
$('#datetimepicker8').datetimepicker({
onGenerate:function( ct ){
$(this).find('.xdsoft_date')
.toggleClass('xdsoft_disabled');
},
minDate:'-1970/01/2',
maxDate:'+1970/01/2',
timepicker:false
});
$('#datetimepicker9').datetimepicker({
onGenerate:function( ct ){
$(this).find('.xdsoft_date')
.toggleClass('xdsoft_disabled');
},
minDate:'-1970/01/2',
maxDate:'+1970/01/2',
timepicker:false
});
});
</script>
<input type="text" id="datetimepicker8"/>
<input type="text" id="datetimepicker9"/>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
511 次 |
| 最近记录: |