Search
 
SCRIPT & CODE EXAMPLE
 

SQL

convert minutes to hours sql

DECLARE
    @FirstDate datetime,
    @LastDate datetime

SELECT
    @FirstDate = '2000-01-01 09:00:00',
    @LastDate = '2000-01-01 11:30:00'

SELECT CONVERT(varchar(12), 
       DATEADD(minute, DATEDIFF(minute, @FirstDate, @LastDate), 0), 114) 

/* Results: 02:30:00:000 */


/* For less precision  */
SELECT CONVERT(varchar(5), 
       DATEADD(minute, DATEDIFF(minute, @FirstDate, @LastDate), 0), 114) 
       
/* Results: 02:30 */
Comment

convert minutes to hours in sql

SELECT minutes/60.0 AS hours FROM TABLE_NAME;

Comment

PREVIOUS NEXT
Code Example
Sql :: create table 
Sql :: creating a database sql 
Sql :: What is SQL data store? 
Sql :: php select data from mysql database without column name 
Sql :: drop unique 
Sql :: sql to excel pgadmin 
Sql :: android sqlite get rows count 
Sql :: delete sql 
Sql :: replace function in sql 
Sql :: sql lowest number possible 
Sql :: disable database droping sql 
Sql :: apex for oracle 11g 
Sql :: joint query 
Sql :: sqlalchemy filter by relationship 
Sql :: Write an SQL query to print details of the Workers whose FIRST_NAME ends with ‘h’ and contains six alphabets. 
Sql :: while mysql 
Sql :: sql constraints 
Sql :: what is mysql 
Sql :: Sql Text or Varchar 
Sql :: sql like operator 
Sql :: sql check 
Sql :: how to join result table in mysql 
Sql :: non relational database 
Sql :: setup mysql and wordpress on docker mac 
Sql :: sql server set complex constraints 
Sql :: First Step in installing SQL workbench 
Sql :: mysql collation portugues brasil 
Sql :: script to run SP_SPACESED on all tables in DB 
Sql :: plus or add balance in postgresql sql 
Sql :: postgresql insert string 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =