Answers for "sql calculate interval"

SQL
1

convert time interval to int in sql

# The 'time_interval' is the variable/column name.

EXTRACT (epoch FROM time_interval)
#This gives you the value of the interval in seconds. 
#Divide it by the number of seconds per period to get it in other time duration formats.
#Eg. minutes, days, hours etc.

EXTRACT (epoch FROM time_interval)/60 #for minutes

EXTRACT (epoch FROM time_interval)/3600 #for hours

EXTRACT (epoch FROM time_interval)/86400 #for days...
Posted by: Guest on August-08-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language