Sql convert hours to days hours minutes. However, the minutes to be converted are calculated I have read all the posts on StackOverflow about converting an integer from seconds to hours and minutes. : 526. In your example the first day = 18 and the second day = 19, so DATEDIFF considers that a day Hi I have a field in my table which has values in minutes. days, hours, minutes, seconds) Is there a simple way to convert that How can I convert hours to minutes? For Example: I want convert 3:30 to minutes. Now how do I get number of days based on that using SQL? SQL SERVER – Shorter way to convert Seconds to Days, Hours, Minutes, Seconds April 10, 2013 by Muhammad Imran Today, I came across this question in a forum – How to I need convert a millisecond value, 85605304. The following statement does is able to convert any seconds The terminal minutes are calculated by subtracting term_end_load_time from the order_entry time (Start to finish). Could anyone tell me how to convert that to the format; 3 Years, 15 minutes is equivalent to 15 minutes. This is the code I am using: Let's suppose I have 2 intervals: INTERVAL '0 00:30:00' DAY TO SECOND INTERVAL '0 04:00:00' DAY TO SECOND What is the most elegant way to get amount of minutes in each SQL query to display total days, hours and minutes between two dates in sql server using datediff () method. ') Possible Duplicate: Efficient way to convert second to minute and seconds in sql server 2005 I have a query which needs to return the second in Day, Hour, Minute, Second Currently having Minutes(bigint) as 390 I want to convert this Minutes to hours. Hi All, I need to convert a time with data type of float into hours and minutes. I researched online and found a solution on stackoverflow for converting Microsoft SQL Server articles, forums and blogs for database administrators (DBA) and developers. Tested Convert Seconds to Minutes, Hours and Days in SQL Server. Interval type represents intervals of time either on a Now my manager wants to convert the time, which is in seconds to the format Hour : Minute : Seconds. Is there a way to get the time remaining (difference) between two dates? For example I'd like to have it return 6 days, 10 hours, 3 minutes and 37 seconds. 00. Could anyone tell me how to convert that to the format; 3 Years, You need to convert them into number of days, hours, minutes and seconds and show them in the reporter. Reference Function and stored procedure reference Date & time HOUR Categories: Date & time functions HOUR / MINUTE / SECOND Extracts the corresponding time part from a time or how to convert varchar (hh:mm) to minutes in oracle sql. The idea is to convert this to a date and then use to_char() for the conversion: I have average duration between several dates (DATETIME format) ie. 0 instead. i. Are you sure you want that? from where DD Defines date-time intervals with a format similar to the date and time syntax by breaking the string into the fields for days, hours, minutes, seconds, and microseconds. Discussion To calculate the difference between the arrival and the departure in T-SQL, use the DATEDIFF(datepart, startdate, enddate) function. Today I am going to talk about creating a simple script to convert the Minutes to I have a sql select that transforms two datetime column difference into an interval: select column_1 - column_2 from my_table , which returns +04 02:21:28. The TSQL script mentioned in this article can Here is syntax for showing hours and minutes for a field coming out of a SELECT statement. I can't seem to find anything with a search. PostgreSQL INTERVAL Data Type Overview In PostgreSQL, intervals In my earlier article, I wrote the solution Shorter way to convert Seconds to Days, Hours, Minutes, Seconds . 000000 I am using Hello, I am having some issues converting time to decimal from one of my column which display it as 2014-07- 08:16:31. How can I convert Converting times into days, hours, minutes, or seconds has many practical applications. Here is the query to convert TIME value to days hours form − mysql> SELECT CONCAT( FLOOR(HOUR(DueTime)/24),' DAYS, ', HOUR(DueTime) MOD 24, ' HOURS. Something like convert 570 minutes in format In this tutorial we will learn how to convert minutes to HH:MM format in SQL Server using SQL Function. 0 As VARCHAR I have the following T-SQL code to change the difference between datetime columns into hours, minutes, and seconds CONVERT (varchar (6), DATEDIFF (second, Learn how to accurately convert date differences in SQL Server to a readable format of days, hours, and minutes. I want to convert those minutes to hh:mm format. Quick and accurate time unit conversions for any value. The following statement does is able to convert any seconds I tried converting to integer value by using CAST() AS int but this made '0. 3587 to a value like 0d 18h 21m. Morning Team, I have an Oracle SQL script that is calculating from creation of an event and how many minutes old compared to the systimestamp. No idea on how to start that, is there something similar to a TimeSpan in SQL like there is in C#? Insert Into #SampleTable Values ('12525'); -- To calculate Total Hours and Minutes Select numasdate, Cast (numasdate / 60 as Varchar) + ' hours ' + Cast (numasdate % 60 as Varchar) Hi I have a field in my table which has values in minutes. 1900-01-01 01:30. In this article we will see This is my query: SELECT TIMEDIFF(end_time,start_time) AS "total" FROM `metrics`; which gives me: 116:12:10 meaning 116 hours, 12 minutes and 10 seconds. Free online time converter tool. 47 minutes and 8 A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions. Changing one value I am calculating time worked based on minutes worked. i have two column time allowed hrs and time View 13 Replies View Related Transact SQL :: To Display Days Hours Mins Format Based On Business Hours Apr 22, 2015 I want to display Days Hours Mins Format. A resident will work more that 24 hours. 133 minutes. Problem You’d like to display a number of seconds as a time value in hours, minutes, and seconds in MySQL. However In this detailed article, I’ll walk you through various methods for calculating the date difference in hours in SQL Server, providing practical examples and sharing tips on handling T-SQL Convert Function and Display Time in Hour:Minute Format from a Datetime Data Type Column or Variable SQL developers and SQL Database administrators may require to get time The following gives you days, hours, minutes, seconds, and works up to 31 days. However they We then use the DATEDIFF function and calculate the difference between two dates in seconds and store it in another variable. 6 days or 5 days, 3. Use these functions to get durations in days to i'm having trouble in converting seconds in Bigquery, is there any function to convert seconds to hour:minute:second format in Bigquery? i already tried the I have the following T-SQL code to change the difference between datetime columns into hours, minutes, and seconds CONVERT (varchar (6), DATEDIFF (second, Possible Duplicate: Efficient way to convert second to minute and seconds in sql server 2005 I have a query which needs to return the second in Day, Hour, Minute, Second Currently having Minutes(bigint) as 390 I want to convert this Minutes to hours. 2 days etc to hours. Example Our database has a table You can create three calculated fields using the expressions mentioned above to display the time in days, hours, and minutes. 50 as 13. 000 (datetimecreated) A solution to make this work Greetings! What is the best way to convert a varchar value of time in hh:mm:ss to minutes? For example: Time: 01:23:45 Minutes: 83. For timestamp_expr, the timestamp to convert SQL Server has a built-in function, DATEDIFF, that calculates the difference between two dates or datetimes. I need to convert to hours. As per the requirement now In one of my earlier articles I wrote about How to convert seconds to Day (s), Hour (s), Minute (s), Second (s) . 4 hours, 5 minutes and 8 seconds is equivalent to 245. For example: 1. Generally, to achieve this result, you need to perform lots of Microsoft SQL Server articles, forums and blogs for database administrators (DBA) and developers. I need to convert a time with data type of float into hours and minutes. I want to convert everything into hours. 30 In this tutorial we will learn how to convert minutes to HH:MM format in SQL Server using SQL Function. Instead, I want it to say 4 Free online time converter tool. I would still be curious to convert the above We can use the functionality to get the hour and minutes. days, hours, minutes, seconds) Is there a simple way to convert that Time Converter With the help of this online calculator, you can easily convert time between different formats, including seconds, minutes, hours, and days. Using the above columns, you can display the . How do I convert that to a number of hours (106 in this case?) Is there a function or should I bite the bullet and do something like extract( Hey guys, I have a column in the SQL Server database which tells me the number of minutes between 2 dates. I want the days, hours and minutes from that - either as a tuple or a dictionary I'm not fussed. I need to convert the Let's suppose I have 2 intervals: INTERVAL '0 00:30:00' DAY TO SECOND INTERVAL '0 04:00:00' DAY TO SECOND What is the most elegant way to get amount of minutes in each February 15, 2012 at 11:03 pm #1447661 pwalter83 (2/15/2012) Hi, I have a requirement to convert minutes to HH:MM:SS format. Convert seconds to days, hours, minutes, seconds (MySQL) Asked 8 years, 8 months ago Modified 3 years, 3 months ago Viewed 18k times I have a Query that shows downtime in hours, minutes but would need it to show it in Days,hours,minutes and maybe Another version that shows Days,hours I'm not good at In my earlier article, I wrote the solution Shorter way to convert Seconds to Days, Hours, Minutes, Seconds . I am using this statement to achieve the results below: I've got a timedelta. How is it possible? Never in my life have I seen a days:hours format. Generally, to achieve this result, you need to perform lots of Defines date-time intervals with a format similar to the date and time syntax by breaking the string into the fields for days, hours, minutes, seconds, and microseconds. 000000 I am using You need to convert them into number of days, hours, minutes and seconds and show them in the reporter. 0 suffice? You can be more granular with SECOND if you need to, just divide by 3600. For example: HH:MM Minutes 08:00 480 08:45 525 07:57 477 string_expr or timestamp_expr or 'integer' or variant_expr Expression to be converted into a time: For string_expr, the string to convert to a time. i want to convert minutes to hours and minutes that is if there are 350 minutes it should be 5. In this example, the SQL field is named "UpdatedOnAt" and is a DateTime. For example: HH:MM Minutes 08:00 480 08:45 525 07:57 477 hi all, i want to do two things 1. G. Is there any function to convert it? Eg: 390 as 6. I would like to convert it, easly to a number of day, Learn how to efficiently convert seconds into a more Hi, Running SQL Server 2008 R2. Learn about the interval type in Databricks Runtime and Databricks SQL. 5 will be converted into 10 days, 12 hours, 00 minutes and 00 seconds. The I have to calculate the difference in hours (decimal type) between two dates in SQL Server 2008. Convert between seconds, minutes, hours, days, weeks, months and years. 55 minutes. (hint: % is This function is to convert duration in minutes to readable hours and minutes format. As an example, I need to convert the current date/time alone into minutes, i. e. There's a little trick Today I had to convert a "number" of minutes into hours:minutes format. I had looked into the time The INTERVAL DAY TO SECOND stores a period of time in terms of days, hours, minutes, and seconds. I'd really like to This Blog will enplane about how to convert second into hours: Minute: seconds format by using function in sql server. Example Row 1 result: 19:53:45 Row 2 result: 1 day 05:41:58 I am trying to convert a datetime (createTime) field from its default 2012-10-06 02:29:37. This is due to the values in this column being I wish to convert a single Oracle datetime value to minutes. I'm trying to convert a duration total to Days, Hours and Minutes. However, the minutes to be converted are calculated In one of my earlier articles I wrote about How to convert seconds to Day (s), Hour (s), Minute (s), Second (s) . (hint: % is I'd really like a query to be able to show me that up time in a easy to read format day (s) hour (s) minute (s) but I'm not quite sure how to do it. Example Row 1 result: 19:53:45 Row 2 result: 1 day 05:41:58 For larger numbers, I wish to display days and hours - ie, 3 days, 14 hours I do not need to display any smaller unit than hours, and values should be rounded down to the Frequently we are asked -- how can I find the number of minutes between two dates or what is the amount of elapsed time. g- 1d 21h 59m 48s). This SQL Function can be used throughout the DATEDIFF counts the number of times a day changed to the next day. ---This video is Many a times we may need to get the Time, Hour, Minute, Second and Millisecond Part from DateTime in Sql Server. 25 to 95:15 etc Many thanks for any assistance. I'm retrieving data from ServiceNow using the REST API and for some of the columns I get a value similar to "2 Days 4 Hours 43 Minutes 29 Seconds". How can I convert DATETIME to format hours:minutes:seconds where hours can Learn how to efficiently convert seconds into a more human-readable format of days, hours, minutes, and seconds using Snowflake SQL queries. Now how do I get number of days based on that using SQL? I need convert a millisecond value, 85605304. Instead, I want it to say 4 Say I have an interval like 4 days 10:00:00 in postgres. Given below is the simple script to convert Minutes I have a select query that has DURATION column to calculate number of Minutes . It basically stores Time as HH:MM Format. g. 58333Hours' into '1 Hours'. I'd really like to It is to be noted that how to use SQL Server DATEDIFF() SQL TIME function can be used to calculate the number of hours, minutes, Morning Team, I have an Oracle SQL script that is calculating from creation of an event and how many minutes old compared to the systimestamp. Syntax What is the best way to return the "duration" of an event in SQL, given the start and end datetime values? How can we add up these durations to return grand totals? What data Learn how to convert TIMEDIFF output into a Day-Hour-Minute-Second format in MySQL with this comprehensive guide. No idea on how to start that, is there something similar to a TimeSpan in SQL like there is in C#? There’s a little trick Today I had to convert a “number” of minutes into hours:minutes format. The data type as fixed as float in DB so cannot change. I had looked into the time function, but it Hello, I am having some issues converting time to decimal from one of my column which display it as 2014-07- 08:16:31. 243 format to am/pm so I use convert (varchar, CreateTime, 100) as CreateTime and You have to use CAST to convert Min data type to VARCHAR. Hi, Anyone got a simple method for converting decimal time duration to HH:MM. 7 hours and 33 seconds is equivalent to 420. With Oracle Dates, this is pretty trivial, you can get either TOTAL Learn how to convert TIMEDIFF output into a Day-Hour-Minute-Second format in MySQL with this comprehensive guide. I have a database column containing an NVARCHAR value that represents a systems up time in Days,hours,minutes and seconds(e. Example: Date 1: 7/30/12 4:00 PM Convert seconds into days hours minutes seconds in snowflake QUERY Input time in Seconds: 259321 Output time : 3 days, 2 minutes, 1 second T-SQL Learn how to efficiently transform time strings in the format HH:mm:ss into either the equivalent time data type, the total number of minutes, or the total number of seconds using Does SUM(DATEDIFF(MINUTE, 0, calcHsTrabajadas))/60. Here is syntax for showing hours and minutes for a field coming out of a SELECT statement. 126 seconds = 2:06. 5 to 1:30 30. Duration has values like 60, 120,150 For example: 60 As a developer there are times when yo need to convert seconds to minutes, hours and days. My requirement is to display work hours in DD:HH format. For example, 10. When working with date and time data in PostgreSQL, intervals are a common way to represent a span of time. This is the code I am using: Hi, another basic question as you are really good and quick I have a field, a time field, containing the number of seconds. Sometimes, you may need to extract specific components from an I have a Query that shows downtime in hours, minutes but would need it to show it in Days,hours,minutes and maybe Another version that shows Days,hours I'm not good at How would you convert a number of minutes to number of days? For instance, number of minutes is 20160. Something like convert 570 minutes in Learn how to convert the difference between dates or timestamps into any units you want. In this article Definition and Usage The DATEDIFF () function returns the difference between two dates, as an integer. I need to be able to get the total hours and minutes if it is over 24 hours from a decimal column in SQL Server. This tutorial explains how to extract hours and minutes from a timestamp in PostgreSQL, including an example. I must have done this a dozen times in a dozen languages over the Another option is if you can help me to calculate the difference between the two dates in days, hours, minutes and seconds. DECLARE @intTime Convert seconds to days, hours, minutes, seconds (MySQL) Asked 8 years, 8 months ago Modified 3 years, 3 months ago Viewed 18k times In my earlier article, I wrote the solution Shorter way to convert Seconds to Days, Hours, Minutes, Seconds . Changing one value There’s a little trick Today I had to convert a “number” of minutes into hours:minutes format. Introduction In this tutorial we will learn how to convert Seconds to Days, Hours, Minutes & Seconds in SQL. 30 minutes = 31,578 seconds which should read 08 hrs. When they work more that 24 hours I get back 1 minute. Recently, I received a request inquiring how to convert Milliseconds SQL query to display total days, hours and minutes between two dates in sql server using datediff () method. Hi, another basic question as you are really good and quick I have a field, a time field, containing the number of seconds. Generally, to achieve this result, you need to perform lots of divisions and remainders and then convert Minutes to Day, Hour, Minute. E. So for instance someone works 7 hours a day and over the course of a month has worked 560 hours. So 13. DB is SQL Server 2008R2. DECLARE @intTime We then use the DATEDIFF function and calculate the difference between two dates in seconds and store it in another variable. A lot of examples I've found Today I am going to talk about creating a simple script to convert the Minutes to Day (s), Hour (s) & Minute (s). And This Blog will enplane about how to convert second into hours: Minute: seconds format by using function in sql server. 75 to 30:45 95. However, the returning Hi, I have a SQL table that has following fields & data ID NAME START 1 User1 631 2 User2 726 3 User3 551 4 User4 908 My query looks like this: Select Top 1000 ID ,NAME We can use the functionality to get the hour and minutes. Time Converter With the help of this online calculator, you can easily convert time between different formats, including seconds, minutes, hours, and days. The TSQL script mentioned in this article can be used to Convert I have a column like this - XXX_2019 234 2142 1423 4634 7886 3143 3243 I want to output XXX_2019 3 hours, 54 minutes 1 days, 11 hours, 42 minutes 23 hours, 43 minutes Is there a way to get the time remaining (difference) between two dates? For example I'd like to have it return 6 days, 10 hours, 3 minutes and 37 seconds. Convert minutes to Hours:Minutes Forum – Learn more on SQLServerCentral I need to be able to get the total hours and minutes if it is over 24 hours from a decimal column in SQL Server. DATEDIFF counts the number of times a day changed to the next day. In this comprehensive guide, we’ll explore how to The previous statement does not work for seconds greater or equal to 86400 (which is how many seconds there are in a day). Tested Introduction In this tutorial we will learn how to convert Seconds to Days, Hours, Minutes & Seconds in SQL. 30 Hi, I have a sql field that returns an elapsed time value in milliseconds (i. SQL query to display total days, hours and minutes between two dates in sql server using datediff () method. I'd like to convert it to hours and minutes. Discover the solution to a common issue with SQL SERVER – Shorter way to convert Seconds to Days, Hours, Minutes, Seconds April 10, 2013 by Muhammad Imran Today, I came across this question in a forum – How to It is to be noted that how to use SQL Server DATEDIFF() SQL TIME function can be used to calculate the number of hours, minutes, Hi, I have a sql field that returns an elapsed time value in milliseconds (i. Discover the solution to a common issue with If minutes is your number of minutes, minutes%60 will give you the minutes only, (minutes/60)%24 will give you hours only, minutes/(60*24) will give you days only. Today I am going to talk about creating a simple script to convert the Minutes to I have Hours,Minute,Second, and days as results in the Postgres query. 50 2. If you are working on a problem with several time variables, you must convert all the times to the same I am currently working an SQL script to calculate the difference between two dates which would give me the result in DD:HH:MI:SEC format. Hi All, Learn how to accurately convert date differences in SQL Server to a readable format of days, hours, and minutes. I have an elapsed time column called [Elapsed_Time] with a data type of [varchar]. The TSQL script mentioned in this article can be used to Convert Seconds to my code gives TOTAL HOURS in hours, but i am trying to output something like TotalHours 8:36 where 8 represents hour part and 36 represents minutes part mean I have a column like this - XXX_2019 234 2142 1423 4634 7886 3143 3243 I want to output XXX_2019 3 hours, 54 minutes 1 days, 11 hours, 42 minutes 23 hours, 43 minutes Is there a way to get the time remaining (difference) between two dates? For example I'd like to have it return 6 days, 10 hours, 3 minutes and 37 seconds. : select (sysdate)*24*60 from dual but My requirement is to display work hours in DD:HH format. How can I convert hours to minutes? For Example: I want convert 3:30 to minutes. This is my query: SELECT TIMEDIFF(end_time,start_time) AS "total" FROM `metrics`; which gives me: 116:12:10 meaning 116 hours, 12 minutes and 10 seconds. I couldn't find any useful technique to convert datetime to decimal with 'CONVERT' on MSDN. 75 minutes Thanks in advance! John F. Today I am going to talk about creating a simple script to convert the Minutes to Day (s), Hour (s) & Minute (s). I tried converting to integer value by using CAST() AS int but this made '0. How do i convert minutes to represent hours decimally in sql? Asked 11 years, 2 months ago Modified 11 years, 2 months ago Viewed 6k times Many a times we may need to get the Time, Hour, Minute, Second and Millisecond Part from DateTime in Sql Server. Are you sure you want that? from where DD Microsoft SQL Server articles, forums and blogs for database administrators (DBA) and developers. I have a requirement to display user available time in Hours:Minutes:Seconds format from a given total number of seconds value. ') I am having a table in SQL Server where there is a column name TimeSpent Datatype Varchar(25). Finally we use I have Hours,Minute,Second, and days as results in the Postgres query. I'm trying to develop a formula to convert minutes (my raw data) to hh:mm:ss format. How do i convert minutes to represent hours decimally in sql? Asked 11 years, 2 months ago Modified 11 years, 2 months ago Viewed 6k times The following statement will return the time value after converting the seconds value specified in the argument to hours, minutes The previous statement does not work for seconds greater or equal to 86400 (which is how many seconds there are in a day). 0 As VARCHAR Learn how to convert the difference between dates or timestamps into any units you want. 30. Use these functions to get durations How would you convert a number of minutes to number of days? For instance, number of minutes is 20160. datepart In my earlier article, I wrote the solution Shorter way to convert Seconds to Days, Hours, Minutes, Seconds . Insert Into #SampleTable Values ('12525'); -- To calculate Total Hours and Minutes Select numasdate, Cast (numasdate / 60 as Varchar) + ' hours ' + Cast (numasdate % 60 as Varchar) When working with date and time data in PostgreSQL, intervals are a common way to represent a span of time. e 2h30m. Sometimes, you may need to extract specific components from an I'm trying to convert a duration total to Days, Hours and Minutes. Recently, I received a request inquiring how to convert Milliseconds I have a stored procedure that returns 4 columns of data Supporthoursworked (This is returned in minutes and multiplied to by 60) SupportHoursCharged February 15, 2012 at 11:03 pm #1447661 pwalter83 (2/15/2012) Hi, I have a requirement to convert minutes to HH:MM:SS format. Appreciate if you know a ORACLE function Hi, I have a column which stores elapsed time in seconds. As others have said SQL Server’s how to convert varchar (hh:mm) to minutes in oracle sql. In your example the first day = 18 and the second day = 19, so DATEDIFF considers that a day my code gives TOTAL HOURS in hours, but i am trying to output something like TotalHours 8:36 where 8 represents hour part and 36 represents minutes part mean Convert Seconds to Minutes, Hours and Days in SQL Server. I would like to convert it, easly to a number of day, i'm having trouble in converting seconds in Bigquery, is there any function to convert seconds to hour:minute:second format in Bigquery? i already tried the Many a times we may need to get the Time, Hour, Minute, Second and Millisecond Part from DateTime in Sql Server. I am Having two Overview This VI demonstrates how to convert hours in decimal format (fraction of hours) to a string containing days, hours, minutes and Hey guys, I have a column in the SQL Server database which tells me the number of minutes between 2 dates. It eliminates the hours if the duration is less than one hour, and shows only the hours if the I have a table where i need to convert for example 2. The following shows the syntax of the INTERVAL DAY TO SECOND Summary: In this tutorial, you’ll learn how to manipulate interval values using the PostgreSQL INTERVAL data type. Since it is above 24 hours format i know i need to convert to nvarchar. This SQL Function can be used throughout Converting Milliseconds to Days, hours, minutes and seconds Asked 12 years, 11 months ago Modified 12 years, 11 months ago Viewed 37k times I have a sql select that transforms two datetime column difference into an interval: select column_1 - column_2 from my_table , which returns +04 02:21:28. Note that this requires converting dates to a timestamp datatype (or using systimestamp in your example). A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions. I need to convert the The terminal minutes are calculated by subtracting term_end_load_time from the order_entry time (Start to finish). Recently, I received a request inquiring how to convert Milliseconds Here is the query to convert TIME value to days hours form − mysql> SELECT CONCAT( FLOOR(HOUR(DueTime)/24),' DAYS, ', HOUR(DueTime) MOD 24, ' HOURS. Recently, I received a request inquiring how to convert Milliseconds I have a stored procedure that returns 4 columns of data Supporthoursworked (This is returned in minutes and multiplied to by 60) SupportHoursCharged Converting Milliseconds to Days, hours, minutes and seconds Asked 12 years, 11 months ago Modified 12 years, 11 months ago Viewed 37k times Learn how to accurately convert date differences in SQL The DATEPART () function is used to return a single part of a date/time, such as year, month, day, hour, minute, etc. Something like convert 570 minutes in If minutes is your number of minutes, minutes%60 will give you the minutes only, (minutes/60)%24 will give you hours only, minutes/(60*24) will give you days only. 000 (datetimecreated) A solution to make this work T-SQL Convert Function and Display Time in Hour:Minute Format from a Datetime Data Type Column or Variable SQL developers and SQL Database administrators may require to get time If you can collect duration in minutes, storing it as a decimal count of minutes and only ever converting it as a presentation layer thing is probably the best approach. In this article I am calculating time worked based on minutes worked. I am doing this as CAST (col1/60 AS VARCHAR (6)) + ':' + CAST (col1%60.