Search
 
SCRIPT & CODE EXAMPLE
 

SQL

date diff sql

SELECT DATEDIFF(year, '2017/08/25', '2011/08/25') AS DateDiff;
Comment

sql date diff

SELECT DATEDIFF('2022-04-08',Date('2022-04-06 20:23:08')) as days,
TO_DAYS('2022-04-08') - TO_DAYS(date('2022-04-06 20:23:08')) as todays

//hours
SELECT TIMESTAMPDIFF(HOUR,NOW(),'2013-05-15 10:23:23')
   calculates difference in hour.(for days--> you have to define day replacing hour
Comment

PREVIOUS NEXT
Code Example
Sql :: how to truncate table with foreign key constraint postgresql 
Sql :: postgres json to string 
Sql :: DB: in eloquent using sql 
Sql :: SQL CREATE UNIQUE INDEX for Unique Values 
Sql :: mysql cashing error 
Sql ::  
Sql :: create new schema mysql 
Sql :: how to change a column name in postgresql 
Sql :: sql extract numbers from string 
Sql :: current date sql 
Sql :: mysqldump --skip-lock-tables 
Sql :: oracle timestamp to date 
Sql :: username sql 
Sql :: remove user and their privileges postgres 
Sql :: oracle remove line breaks 
Sql :: postgresql size of database 
Sql :: mysql date range 
Sql :: modify column name in sql 
Sql :: DATE_SUB postgres 
Sql :: foreign key constraint in ms sql 
Sql :: mysql delete table with foreign key 
Sql :: delete ids between sql 
Sql :: postgresql create role 
Sql :: how to connect postgresql database with java 
Sql :: how to uninstall postgresql 13 on mac 
Sql :: download sql server 2016 
Sql :: pyspark sql row get value 
Sql :: mysql server not starting in xampp in mac 
Sql :: reset auto increment mysql 
Sql :: sql server last character in string 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =