dhana dhana - 2 years ago 86
MySQL Question

calculate difference between two timings in minutes in MYSQL

I am new to MYSQL and i am a salesforce developer.
How to calculate difference between two timings in minutes in MYSQL.

(L1_Finish_TimeStamp__c - L1_Start_TimeStamp__c)


I tried:

Timediff(L1_Finish_TimeStamp__c, L1_Start_TimeStamp__c)/144


But it is not working correctly. Please guide me in this.

Answer Source

Try:

(unix_timestamp(L1_Finish_TimeStamp__c)-unix_timestamp(L1_Start_TimeStamp__c))/60

As far as I assume L1_Finish_TimeStamp__c and L1_Start_TimeStamp__c contains timestamps in format like 2017-08-16 09:29:21, hence we have convert it into unix timestamp which is integer value and contains seconds so we have divide difference to 60.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download