Hi
I have read that in sqlserver the date takes 4 bytes for no. of days
before or after the base date and another 4 bytes for the no. of
milliseconds.
But when I convert the date into a float and try to correlate the
decimal part with the no. of milliseconds, I am totally lost.
Moreover, in Inside Sql Server 2000 book by Delaney the following is mentioned ( not verbatim ) ,
declare @.dt datetime
select @.dt = getdate()
select convert(int,substring(varbinary(8),@.dt),5,4))
What is this number going to represent? Given a datetime I need to know how many seconds have elapsed from midnight ( from the time part ).
Thanks
Joemaybe somthing like this?
set nocount on
select datepart(hh,getdate())
, datepart(mi,getdate())
, datepart(ss,getdate())
, datepart(ms,getdate())
, getdate()
select (datepart(hh,getdate())*60*60)
, (datepart(mi,getdate())*60)
, datepart(ss,getdate())
, datepart(ms,getdate())
, getdate()
select (datepart(hh,getdate())*60*60) +
(datepart(mi,getdate())*60) +
datepart(ss,getdate())
, datepart(ms,getdate())
, getdate()
No comments:
Post a Comment