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 2000 Forums
 Transact-SQL (2000)
 Format on a datetime field

Author  Topic 

shifis
Posting Yak Master

157 Posts

Posted - 2003-04-25 : 20:00:10
I have a datetime field and I want to give it the next format YYYYMMDD, how can I do that?
Thanks!!

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-04-25 : 20:32:31
SELECT Convert(char(8), getdate(), 112)

Just replace getdate() with your date column/value. Books Online has more details under "CONVERT" on the available date formats.

Go to Top of Page
   

- Advertisement -