MMMMS
MMMMS

Reputation: 2201

How to make timestamp minutes 00 in mysql

Actually I want to replace timestamp minutes into 00 for all selected date from my table like below,

2016-03-28 04:58:37

2016-03-28 05:58:33

2016-03-28 06:24:18

into

2016-03-28 04:00:37

2016-03-28 05:00:37

2016-03-28 06:00:18

I must do this in select query only. anybody have idea for this?

Upvotes: 0

Views: 66

Answers (1)

sagi
sagi

Reputation: 40481

Try this :

YourColumnHere - second(YourColumnHere);

Or this:

date_format(YourColumnHere, '%Y-%m-%d %H:00:%S');

Or this:

SEC_TO_TIME(((TIME_TO_SEC(YourColumnHere)+30) DIV 60) * 60

Upvotes: 3

Related Questions