Sudip
Sudip

Reputation: 23

How to calculate exact (minutes) from mysql?

I want to calculate time in (minutes) between two datetime data

it_helpdesk-table

request_Date                xetr                   CALCULATE_TIME (I want)
01/01/2017 10:20 AM         01/01/2017 10:40 PM     20 MINUTES
01/01/2017 10:20 AM         01/01/2017 12:20 AM     120  MINUTES

I USE THIS CODE BUT GET WRONG O/P

TIMESTAMPDIFF(MINUTE,Request_Date, Xetr) as WH

Upvotes: 2

Views: 54

Answers (1)

JohnHC
JohnHC

Reputation: 11205

Why not timediff() and time_to_sec()?

select time_to_sec(timediff(Request_Date, Xetr))/60 as WH

Upvotes: 1

Related Questions