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
 General SQL Server Forums
 New to SQL Server Programming
 Convert(DateTime) problem

Author  Topic 

sanjay5219
Posting Yak Master

240 Posts

Posted - 2009-09-18 : 10:28:47
Dear All,

Select convert(datetime,convert(char(8),a.audit_date,112),103),a.asso_id,b.emp_name,count(distinct audit_no) from T1 a,T2 b
where a.asso_id=b.userid
group by convert(datetime,convert(char(8),a.audit_date,112),103),a.asso_id,b.emp_name
order by convert(datetime,convert(char(8),a.audit_date,112),103),a.asso_id,b.emp_name


output is coming like this

2008-01-02 00:00:00.000 11100 Name Name 1

I want only date not this 00:00:00.000

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-09-18 : 10:34:15
u just need this

convert(varchar(10),a.audit_date,120)
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-18 : 10:45:47
If you want to show formatted dates in front end application, do formation there

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sanjay5219
Posting Yak Master

240 Posts

Posted - 2009-09-18 : 11:15:16
Great Working fine
Thanks
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-09-18 : 11:40:23
quote:
Originally posted by sanjay5219

Great Working fine
Thanks



WELCOME
Go to Top of Page
   

- Advertisement -