<bdo id='TCuna'></bdo><ul id='TCuna'></ul>

    <tfoot id='TCuna'></tfoot>
      <i id='TCuna'><tr id='TCuna'><dt id='TCuna'><q id='TCuna'><span id='TCuna'><b id='TCuna'><form id='TCuna'><ins id='TCuna'></ins><ul id='TCuna'></ul><sub id='TCuna'></sub></form><legend id='TCuna'></legend><bdo id='TCuna'><pre id='TCuna'><center id='TCuna'></center></pre></bdo></b><th id='TCuna'></th></span></q></dt></tr></i><div id='TCuna'><tfoot id='TCuna'></tfoot><dl id='TCuna'><fieldset id='TCuna'></fieldset></dl></div>

    1. <small id='TCuna'></small><noframes id='TCuna'>

      <legend id='TCuna'><style id='TCuna'><dir id='TCuna'><q id='TCuna'></q></dir></style></legend>

      MySQL STR_TO_DATE 函数不工作

      MySQL STR_TO_DATE function not work for time(MySQL STR_TO_DATE 函数不工作)
        <bdo id='NQRrA'></bdo><ul id='NQRrA'></ul>

        <small id='NQRrA'></small><noframes id='NQRrA'>

        1. <legend id='NQRrA'><style id='NQRrA'><dir id='NQRrA'><q id='NQRrA'></q></dir></style></legend>
              <tfoot id='NQRrA'></tfoot>

                <tbody id='NQRrA'></tbody>
            1. <i id='NQRrA'><tr id='NQRrA'><dt id='NQRrA'><q id='NQRrA'><span id='NQRrA'><b id='NQRrA'><form id='NQRrA'><ins id='NQRrA'></ins><ul id='NQRrA'></ul><sub id='NQRrA'></sub></form><legend id='NQRrA'></legend><bdo id='NQRrA'><pre id='NQRrA'><center id='NQRrA'></center></pre></bdo></b><th id='NQRrA'></th></span></q></dt></tr></i><div id='NQRrA'><tfoot id='NQRrA'></tfoot><dl id='NQRrA'><fieldset id='NQRrA'></fieldset></dl></div>
              • 本文介绍了MySQL STR_TO_DATE 函数不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我只想将时间与另一个时间字符串进行比较,所以我使用 STR_TO_DATE 函数将我的时间字符串转换为日期时间格式

                I want only time to compare with another time string, so i am using STR_TO_DATE function to convert my time string to date time format

                下面的语句对我来说很好用,所以我认为 MySQL 没有任何问题

                Below statement works fine for me, so i think MySQL don't have any problem

                SELECT STR_TO_DATE('26/04/2011', '%d/%m/%Y');
                

                但我不知道为什么下面的对我不起作用

                But i don't know why below one is not working for me

                SELECT STR_TO_DATE('11:59:59','%h:%i:%s');  
                

                当我在 PhpMyAdmin 的 SQL 控制台中运行时,上述语句总是返回 NULL

                Above statement always return NULL when i run in SQL Console of PhpMyAdmin

                推荐答案

                这确实是因为 SQL 模式 NO_ZERO_DATE.当 Anand Rockzz 链接到手册时,您应该已经看到了,但该链接只是解释的一半.从 MySQL 5.7.4 开始,该设置已被弃用.在你的第一个例子中,你正在设置一个日期;在第二个中, NO_ZERO_DATE 导致返回 NULL,因为您没有指定日期.从 5.7.8 开始,NO_ZERO_DATENO_ZERO_IN_DATE 已包含在默认 sql_mode 值中.根据手册,看起来好像弃用和删除已部分恢复(从 5.7.8 开始),因此您可以在 my.cnf(或每个会话)中明确设置它.

                This is indeed because of the SQL mode NO_ZERO_DATE. You should have seen that when Anand Rockzz linked to the manual, but that link is only half of the explanation. As of MySQL 5.7.4, the setting is deprecated. In your first example, you're setting a date; in the second one, NO_ZERO_DATE causes the return of NULL because you're not specifying a date. Starting with 5.7.8, NO_ZERO_DATE and NO_ZERO_IN_DATE have been included with the default sql_mode value. According to the manual, it appears as if the deprecation and removal has been partially reverted (starting with 5.7.8), so you may be able to explicitly set this in your my.cnf (or per-session).

                您还应该参考有关的手册NO_ZERO_DATE 指令.

                You should also refer to the manual regarding the NO_ZERO_DATE directive.

                这篇关于MySQL STR_TO_DATE 函数不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                    <tbody id='xbyBc'></tbody>

                      • <bdo id='xbyBc'></bdo><ul id='xbyBc'></ul>
                      • <i id='xbyBc'><tr id='xbyBc'><dt id='xbyBc'><q id='xbyBc'><span id='xbyBc'><b id='xbyBc'><form id='xbyBc'><ins id='xbyBc'></ins><ul id='xbyBc'></ul><sub id='xbyBc'></sub></form><legend id='xbyBc'></legend><bdo id='xbyBc'><pre id='xbyBc'><center id='xbyBc'></center></pre></bdo></b><th id='xbyBc'></th></span></q></dt></tr></i><div id='xbyBc'><tfoot id='xbyBc'></tfoot><dl id='xbyBc'><fieldset id='xbyBc'></fieldset></dl></div>

                        <small id='xbyBc'></small><noframes id='xbyBc'>

                          <legend id='xbyBc'><style id='xbyBc'><dir id='xbyBc'><q id='xbyBc'></q></dir></style></legend>
                        • <tfoot id='xbyBc'></tfoot>