Search
 
SCRIPT & CODE EXAMPLE
 

SQL

postgres date difference seconds

-- difference in seconds between two dates

select extract(epoch from ('2020-03-30 09:55:56'::timestamp - '2020-03-30 08:54:55'::timestamp));
-- result : 3661
Comment

postgresql get difference between two dates

select age('2010-04-01', '2012-03-05'),
       date_part('year',age('2010-04-01', '2012-03-05')),
       date_part('month',age('2010-04-01', '2012-03-05')),
       date_part('day',age('2010-04-01', '2012-03-05'));
Comment

postgresql get difference in hours between two dates

select EXTRACT(
	EPOCH FROM now() - (now() - INTERVAL '5 HOUR')
)/3600

-- it will return 5
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql update multiple columns 
Sql :: create fulltext index mysql 
Sql :: one to one and one to many relationship 
Sql :: cql insert 
Sql :: oracle create or replace index 
Sql :: offset in postgresql example 
Sql :: Inser Dataframe into mysql 
Sql :: mysql varchar length 
Sql :: how to avoid duplicate records in sqlite 
Sql :: drop databse 
Sql :: neo4j command to run script file 
Sql :: update multiple rows 
Sql :: import sql file to mysql db using shell commands 
Sql :: mysql calcular idade 
Sql :: automate mysql cli query 
Sql :: select only columns that are not empty oracle sql 
Sql :: WHERE value IS sql 
Sql :: mysql sleep connections 
Sql :: delete all from mysql table 
Sql :: default username and password for oracle 11g 
Sql :: disable database droping sql 
Sql :: postgres execute multiple sql file from command line 
Sql :: how mysql store datetime 
Sql :: sql update subtract value 
Sql :: mysql insert into multiple tables 
Sql :: like in sql 
Sql :: SELECT SQL LIKE 
Sql :: how to link java and mysql 
Sql :: sql example 
Sql :: install sql server windows 10 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =