dbTalk Databases Forums  

How to work with time in format 'hhh:mm:ss' (more than 24 hours)

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss How to work with time in format 'hhh:mm:ss' (more than 24 hours) in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
brazil.mg.marcus.vinicius.lima
 
Posts: n/a

Default How to work with time in format 'hhh:mm:ss' (more than 24 hours) - 09-18-2007 , 06:28 PM






Hello,

I need to create a column that will store hours bigger than 24. For
example '25:00:00', '129:23:12', etc).

That column will be used too, for perform calculations between
datetime intervals: 'time'.
In MySQL there is a datatype that perfect fits that necessity.

Does anyone know what is the corresponding datatype in SQL Server?

Thanks a lot!


Reply With Quote
  #2  
Old   
Roy Harvey (MVP)
 
Posts: n/a

Default Re: How to work with time in format 'hhh:mm:ss' (more than 24 hours) - 09-18-2007 , 06:54 PM






There is no such data type in SQL Server. In SQL Server 2008 we have
been promised a TIME datatype that ranges from 00:00:00 to 23:59:59
(plus milliseconds), but it does not reach 24:00:00, much less go
beyond it.

I would consider that as a display requirement, and store in some
other form such as seconds, converting as needed for display.

Roy Harvey
Beacon Falls, CT

On Tue, 18 Sep 2007 16:28:44 -0700, "brazil.mg.marcus.vinicius.lima"
<marcvlima (AT) gmail (DOT) com> wrote:

Quote:
Hello,

I need to create a column that will store hours bigger than 24. For
example '25:00:00', '129:23:12', etc).

That column will be used too, for perform calculations between
datetime intervals: 'time'.
In MySQL there is a datatype that perfect fits that necessity.

Does anyone know what is the corresponding datatype in SQL Server?

Thanks a lot!

Reply With Quote
  #3  
Old   
brazil.mg.marcus.vinicius.lima
 
Posts: n/a

Default Re: How to work with time in format 'hhh:mm:ss' (more than 24 hours) - 09-18-2007 , 09:25 PM



On 18 set, 20:54, "Roy Harvey (MVP)" <roy_har... (AT) snet (DOT) net> wrote:
Quote:
There is no such data type in SQL Server. In SQL Server 2008 we have
been promised a TIME datatype that ranges from 00:00:00 to 23:59:59
(plus milliseconds), but it does not reach 24:00:00, much less go
beyond it.

I would consider that as a display requirement, and store in some
other form such as seconds, converting as needed for display.

Roy Harvey
Beacon Falls, CT

On Tue, 18 Sep 2007 16:28:44 -0700, "brazil.mg.marcus.vinicius.lima"



marcvl... (AT) gmail (DOT) com> wrote:
Hello,

I need to create a column that will store hours bigger than 24. For
example '25:00:00', '129:23:12', etc).

That column will be used too, for perform calculations between
datetime intervals: 'time'.
In MySQL there is a datatype that perfect fits that necessity.

Does anyone know what is the corresponding datatype in SQL Server?

Thanks a lot!- Ocultar texto entre aspas -

- Mostrar texto entre aspas -



Reply With Quote
  #4  
Old   
brazil.mg.marcus.vinicius.lima
 
Posts: n/a

Default Re: How to work with time in format 'hhh:mm:ss' (more than 24 hours) - 09-18-2007 , 09:28 PM



On 18 set, 20:54, "Roy Harvey (MVP)" <roy_har... (AT) snet (DOT) net> wrote:
Quote:
There is no such data type in SQL Server. In SQL Server 2008 we have
been promised a TIME datatype that ranges from 00:00:00 to 23:59:59
(plus milliseconds), but it does not reach 24:00:00, much less go
beyond it.

I would consider that as a display requirement, and store in some
other form such as seconds, converting as needed for display.

Roy Harvey
Beacon Falls, CT

On Tue, 18 Sep 2007 16:28:44 -0700, "brazil.mg.marcus.vinicius.lima"



marcvl... (AT) gmail (DOT) com> wrote:
Hello,

I need to create a column that will store hours bigger than 24. For
example '25:00:00', '129:23:12', etc).

That column will be used too, for perform calculations between
datetime intervals: 'time'.
In MySQL there is a datatype that perfect fits that necessity.

Does anyone know what is the corresponding datatype in SQL Server?

Thanks a lot!- Ocultar texto entre aspas -

- Mostrar texto entre aspas -
Thanks for your comment.

When I perform a datetime subtraction (get the diference between two
dates) can i convert the results to seconds?
Thanks a lot!



Reply With Quote
  #5  
Old   
Roy Harvey (MVP)
 
Posts: n/a

Default Re: How to work with time in format 'hhh:mm:ss' (more than 24 hours) - 09-18-2007 , 10:39 PM



On Tue, 18 Sep 2007 19:28:20 -0700, "brazil.mg.marcus.vinicius.lima"
<marcvlima (AT) gmail (DOT) com> wrote:

Quote:
When I perform a datetime subtraction (get the diference between two
dates) can i convert the results to seconds?
Thanks a lot!
The DATEDIFF function's first parameter specifies if the difference is
calculated in seconds, minutes, hours, weeks, years, etc.

Roy Harvey
Beacon Falls, CT


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.