Storing only timepart in Sql server datetime

  • Thread starter Thread starter M O J O
  • Start date Start date
M

M O J O

Hi,

How do I store only the time part in a sql server datetime field?

I've tried using ....

Params.Add("@MyField", SqlDbType.DateTime, DateTime.Parse("00:05:00"))

.... but it stores this value "01-09-2004 00:05:00".

I want to store "00:05:00".

Any idea???

Thanks!!!

M O J O
 
Hi Grogory,

I'm doing this already today, but with Delphi. Now I'm using VB.Net and want
to do the same.

I'm using a DateTime field in MS SQL 2000, and by using Delphi's Frac method
(eg. Frac(SomeDateTimeVar)), it is stored in SQL server only showing the
time (when running a query).

I'm not looking for a Time field in SQL, I only want to store the Time in a
datetime.

M O J O
 
Hi MOJO,

It seems that there is no Time field in SQL server. Could we just save
DateTime in SQL server and only use Time and ignore the Date value?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top