HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlModerate

Getting midnight of today

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
midnighttodaygetting

Problem

I want to get 00:00:00 of a day. Should be done without using CONCAT. What options are there?

We can use CURDATE() function in select query but need to display like 2014-05-05 00:00:00. If NOW() will give like 2014-05-05 12:05:37.

I want add default value 00:00:00 with CURDATE() in query.

Solution

The documentation surprisigly contains a solution:

SELECT timestamp(current_date);


(which is basically the same as a comment above).

Code Snippets

SELECT timestamp(current_date);

Context

StackExchange Database Administrators Q#152585, answer score: 13

Revisions (0)

No revisions yet.