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 2008 Forums
 Transact-SQL (2008)
 Count of the day

Author  Topic 

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2012-07-16 : 23:00:55
Hi,

I want to find the day count from starting of the year.

For example: today is 198th day out of 365 days.

How to find this


Thanks,
Gangadhara MS
SQL Developer and DBA

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2012-07-17 : 02:14:48
SELECT DATEDIFF(DAY,('01-01-'+CAST(YEAR(GETDATE())AS CHAR(4))),GETDATE())

--------------------------
http://connectsql.blogspot.com/
Go to Top of Page
   

- Advertisement -