[英]Formatting datetimepicker add-on to jQuery datepicker for use in MySQL
I've Google a lot of answers to this question but none of the proposed solutions seems to work. Google已经为这个问题提供了很多答案,但是所有提议的解决方案似乎都没有用。 I have the following code. 我有以下代码。
<input type="text" id="startDate">
<script>
$( "#startDate" ).datetimepicker({
showOn: "both",
showButtonPanel: true,
dateFormat: 'DD MM dd yy',
controlType: 'select',
oneLine: true,
timeFormat: 'hh:mm tt',
altFormat: 'yy-mm-dd',
altTimeFormat: "HH:hh"
});
This gives me output that looks like this: "Sat Oct 15 2016 09:00:00 GMT-0500 (CDT)". 这给了我这样的输出:“ 2016年10月15日星期六,格林尼治标准时间-0500(CDT)”。 But I need it to look like this "2016-11-03 09:00:00" in order to put it in MySQL. 但是我需要使其看起来像这样的“ 2016-11-03 09:00:00”,以便将其放入MySQL。 I'd like the screen output to stay as is, but the value returned to the PHP must look like the second example. 我希望屏幕输出保持原样,但是返回到PHP的值必须类似于第二个示例。 To do that I think I need to use one or more of the "alt" format options to datetimepicker. 为此,我认为我需要对datetimepicker使用一个或多个“ alt”格式选项。 But no amount of trying has produced what I need. 但是没有多少尝试就能满足我的需求。 Can someone give me an example of what I should do? 有人可以给我一个我应该怎么做的例子吗?
尝试:
format: "YYYY-MM-DD HH:mm:ss"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.