P
P
Pavel2018-03-07 13:56:32
MySQL
Pavel, 2018-03-07 13:56:32

How to convert date in sql query?

The table has a date field, which contains the date in the following format: 05.10.18, 22:00. I need to compare the current date (including minutes) NOW() and the date specified in the date cell in the query. To do this, I write:
WHERE NOW () < date. However, nothing comes out, and, as I understand it, due to the fact that the date is in this format. If we substitute WHERE NOW() < '2018-03-08', then everything works.
Tried to use CONVERT and CAST, didn't work. Tell me how to do it right.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lazy @BojackHorseman MySQL, 2018-03-07
@iSawyer

MySQL STR_TO_DATE() Function

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question