Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Doubt with date

Author  Topic 

rammohan
Posting Yak Master

212 Posts

Posted - 2011-08-22 : 07:55:46
Hi All,

I am working with getdate() function....

I really wanted to know how the following statement work, though it is giving result

select select getdate()- 0.3

Please help me to understand it

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-22 : 09:26:51
getdate() returns system date. date is internal stored as a integer value and 0 value corresponds to base date of 1 Jan 1900. so getdate-0.3 will give you 0.3 of day subtracted from current date time. ie 0.3 * 24 hrs = 7.2 hrs = 432 mins. see below

select getdate()-0.3,dateadd(mi,-432,getdate())

they should give you same value

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

rammohan
Posting Yak Master

212 Posts

Posted - 2011-08-22 : 09:29:55
Thanks Visakh

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-22 : 09:35:33
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -