How to display a past time in days, hours and minutes?
Answer / Vijayraj Singh Baghel
To display a past time in SQL Server in days, hours and minutes, you can use DATEDIFF function. Here's an example:n`DECLARE @pastDate DATETIME = '2022-01-01'; SELECT DATEDIFF(dd, @pastDate, GETDATE()) AS Days,n DATEDIFF(hh, @pastDate, GETDATE()) / 24.0 AS Hours,n DATEDIFF(mi, @pastDate, GETDATE()) / (60 * 24) AS Minutes;`
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the impact on other user sessions when creating indexes?
What is surrogate key? : sql server analysis services, ssas
What is reference section?
How can you tell if a database object is invalid?
What is meant by datasource?
query processing
What are the different types of sql server replication? : sql server replication
A successfully created SSIS package in SQL Server 2005 runs fine in MS BIDS and Integration Services. But gives error when run through an SQL-Job. What are the possible reasons?
What is attribute relationships, why we need it? : sql server analysis services, ssas
What is mscorsvw.exe - process - microsoft .net framework ngen?
How many columns can exist together per table?
What is the use of custom fields in report?
Oracle (3253)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)