﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / Date formatiing / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 22 May 2013 07:30:00 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Date formatiing</title><link>http://www.sqlservercentral.com/Forums/Topic1422299-391-1.aspx</link><description>Even this would do the work for you and is probably much simpler[code="sql"]SELECT	CONVERT(TIME, DATEADD(SECOND, DATEDIFF(SECOND, minibgtime, maxendtime), '' ) )FROM	tablename[/code]</description><pubDate>Thu, 21 Feb 2013 00:33:11 GMT</pubDate><dc:creator>Kingston Dhasian</dc:creator></item><item><title>RE: Date formatiing</title><link>http://www.sqlservercentral.com/Forums/Topic1422299-391-1.aspx</link><description>Never Mind i figured outselect (CONVERT(varchar(6), DATEDIFF(second, minibgtime, maxendtime)/3600) + ':' +RIGHT('0' + CONVERT(varchar(2), (DATEDIFF(second, minibgtime, maxendtime) % 3600) / 60), 2) + ':' +RIGHT('0' + CONVERT(varchar(2), DATEDIFF(second, minibgtime, maxendtime) % 60), 2)) as Total_Timefrom tablenameThankyou.--Sam.</description><pubDate>Wed, 20 Feb 2013 15:28:11 GMT</pubDate><dc:creator>sunder.mekala</dc:creator></item><item><title>RE: Date formatiing</title><link>http://www.sqlservercentral.com/Forums/Topic1422299-391-1.aspx</link><description>select datediff (Mi,Cast((minibgtime) as datetime), Cast((maxendtime) as datetime))/60) as Total_Minutesfrom tablenameThe above Sql Query should give me 2:30:00 instead of 150 minutes, here i have make changes in the above query , just to clarify i have to make changes inthe above query itself.Thankyou.--Sam.</description><pubDate>Wed, 20 Feb 2013 15:09:36 GMT</pubDate><dc:creator>sunder.mekala</dc:creator></item><item><title>RE: Date formatiing</title><link>http://www.sqlservercentral.com/Forums/Topic1422299-391-1.aspx</link><description>add those minutes to a date @ 00:00:00 hrs then format as a time. As an example:declare @mins intset @mins = 150select convert(char(5),dateadd(minute,@mins,'01/01/2013'),108)</description><pubDate>Wed, 20 Feb 2013 14:59:48 GMT</pubDate><dc:creator>sturner</dc:creator></item><item><title>Date formatiing</title><link>http://www.sqlservercentral.com/Forums/Topic1422299-391-1.aspx</link><description>Hi,Here minibgtime and maxendtime are in below format  2013-02-19 16:15:48.000select datediff (Mi,Cast((minibgtime) as datetime), Cast((maxendtime) as datetime))/60) as Total_Minutesfrom tablenameNow i am getting something like a number 150 minutes but i want to see that as 2:30:00as 150 mins = two hrs 30 minutes.Any help is appreciated.Thanks,Sam.</description><pubDate>Wed, 20 Feb 2013 14:12:11 GMT</pubDate><dc:creator>sunder.mekala</dc:creator></item></channel></rss>