Skip to content

Problem with datetime formatting #22

@udi

Description

@udi

The problem might not be specific to datetime formatting, but that's where I'm stuck.

Consider the following query that executes fine directly on mysql:

mysql> SELECT STR_TO_DATE('01:35 PM', '%h:%i %p') as t;
+----------+
| t |
+----------+
| 13:35:00 |
+----------+

However, when I run the exact same query in torndb:

row = conn.get("SELECT STR_TO_DATE('01:35 PM', '%%h:%%i %%p') as t")
print ">>", row.t
I get the following warning (conn is correctly constructed using torndb.Connection):

/Library/Python/2.7/site-packages/torndb.py:226: Warning: Incorrect datetime value: '01:35 PM' for function str_to_date
return cursor.execute(query, kwparameters or parameters)

None

I looked at the mysqld logs, and it seems that both queries are identical in the server, only using torndb I see the following:
290 Query SELECT STR_TO_DATE('01:35 PM', '%h:%i %p') as t
290 Query SHOW WARNINGS

whereas when I run it from mysql, I only see the first line:
46 Query SELECT STR_TO_DATE('01:35 PM', '%h:%i %p') as t

What is going on here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions