sergiol
sergiol

Reputation: 4335

SQLite format time range

I have a time range in seconds and I want it to be in the minutes'seconds format. Example: I have 90 seconds. I want them to be displayed as 1'30 minutes.

As I do not expect things to reach 1 hour, I came with the query on a SQLite test web page

SELECT CAST (90/60 AS INTEGER) || "'" || CAST (90%60 AS INTEGER) FROM demo;

Is there a leaner way to do the same query?

Upvotes: 0

Views: 52

Answers (1)

Habbie
Habbie

Reputation: 2230

How about:

SELECT strftime('%H:%M''%S', datetime(90, 'unixepoch'));

Upvotes: 1

Related Questions