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)
 Change Dateformat

Author  Topic 

dnf999
Constraint Violating Yak Guru

253 Posts

Posted - 2008-06-09 : 06:36:37
Hi

I have fields with this dateformat:

2002-10-09 10:03:00.000

And I want to change to this:

2002/10/09 10:03:00

I've been looking at the help function, but can't seem to find this exact format. Any suggestions??

Thanks!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-09 : 06:54:43
Use CONVERT() function. Look for syntax and usage in books online. Also if this is for display purpose alone try doing it in your front end application

http://msdn.microsoft.com/en-us/library/ms187928.aspx
Go to Top of Page

dass05555
Yak Posting Veteran

55 Posts

Posted - 2008-06-09 : 06:55:25

hi friend,
check this ..,
select CONVERT(VARCHAR(15),getdate(),111)+' '+ right(getdate(),8)

cool...,
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-09 : 07:50:45
quote:
Originally posted by dass05555


hi friend,
check this ..,
select CONVERT(VARCHAR(15),getdate(),111)+' '+ right(getdate(),8)

cool...,


select REPLACE(CONVERT(varchar(19),GETDATE(),121),'-','/')
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-06-09 : 09:48:36
Also if you want to show converted dates in front end application, do formation there

Madhivanan

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

- Advertisement -