Simple timediff:

SELECT time_format(timediff('2014-04-24 09:11:37','2014-04-24 09:09:37'),'%H:%m:%s') as dif

Returns 00:00:00 . Im problably missing something stupid, my apoligies...

Recommended Answers

All 4 Replies

This does work BTW:

SELECT time_format(timediff('2014-04-24 09:11:37','2014-04-24 09:11:47'),'%H:%m:%S') as dif

It returns -00:00:10 like it should

Figured it out.

I have another question:

Would:

SELECT time_format(timediff('2014-04-25 09:11:00','2014-04-23 09:11:00'),'%H:%m:%S') as dif

Return

48:00:00

If not, how can I get it so it can return 48:00:00 ?

Thank you

I pasted your code into MySQL and it returned 48:00:00 as you desired

I pasted your code into MySQL and it returned 48:00:00 as you desired

I didnt test the code, I just saw that %H limits it from 0-23

You are right. It works like I desired.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.