convert time interval to int in sql

Solutions on MaxInterview for convert time interval to int in sql by the best coders in the world

showing results for - "convert time interval to int in sql"
Hannah
25 Nov 2017
1# The 'time_interval' is the variable/column name.
2
3EXTRACT (epoch FROM time_interval)
4#This gives you the value of the interval in seconds. 
5#Divide it by the number of seconds per period to get it in other time duration formats.
6#Eg. minutes, days, hours etc.
7
8EXTRACT (epoch FROM time_interval)/60 #for minutes
9
10EXTRACT (epoch FROM time_interval)/3600 #for hours
11
12EXTRACT (epoch FROM time_interval)/86400 #for days...
13
14