Reputation: 1
It's my SQL query. duration's data in seconds. I want to convert like 12000 second --> 3:20:00
SELECT `user` AS vpn_user,
`remip` AS peerip,
`duration` AS vpn_duration,
FROM_ITIME(`itime`-`duration`) AS start_time,
FROM_ITIME(`itime`) AS end_time,
`tunneltype` AS vpn_type
FROM $log
WHERE $filter
AND `subtype`='vpn'
AND `tunneltype` IN ('ssl-tunnel')
AND `action` = 'tunnel-down'
AND COALESCE(NULLIFNA(`user`), IPSTR(`remip`)) IS NOT NULL
AND `tunnelid` IS NOT NULL
GROUP BY vpn_user,
peerip,
vpn_duration,
start_time,
end_time,
vpn_type
Upvotes: 0
Views: 70
Reputation: 18411
Initially I posted an answer for SQL Server but then I noticed you are probably using MySQL. So check the solution here.
SELECT SEC_TO_TIME(12000)
Upvotes: 1