duanhuilao0787 2016-10-12 19:57 采纳率: 100%
浏览 45

将datetimepicker加载项格式化为jQuery datepicker以在MySQL中使用

I've Google a lot of answers to this question but none of the proposed solutions seems to work. 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)". But I need it to look like this "2016-11-03 09:00:00" in order to put it in MySQL. I'd like the screen output to stay as is, but the value returned to the PHP must look like the second example. To do that I think I need to use one or more of the "alt" format options to datetimepicker. But no amount of trying has produced what I need. Can someone give me an example of what I should do?

  • 写回答

1条回答 默认 最新

  • duaj39673 2016-10-12 20:16
    关注

    try:

    format: "YYYY-MM-DD HH:mm:ss"
    
    评论

报告相同问题?

悬赏问题

  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探