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)
 Date conversion

Author  Topic 

rookie_sql
Constraint Violating Yak Guru

443 Posts

Posted - 2008-04-25 : 10:44:24
Hi am trying to convert my date from the date times stap to
this format 250408

I've tried this : select convert(varchar,getdate(),112)
but the result am getting is '20080425'

RyanRandall
Master Smack Fu Yak Hacker

1074 Posts

Posted - 2008-04-25 : 10:47:25
select replace(convert(varchar(8),getdate(),3), '/', '')


Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
Go to Top of Page

RyanRandall
Master Smack Fu Yak Hacker

1074 Posts

Posted - 2008-04-25 : 10:49:18
There's a table under 'CONVERT function' in BOL which describes the various date formatting options...

Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-04-25 : 10:50:25
quote:
Originally posted by rookie_sql

Hi am trying to convert my date from the date times stap to
this format 250408

I've tried this : select convert(varchar,getdate(),112)
but the result am getting is '20080425'


If you use front end application to show data, use format function there

Madhivanan

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

- Advertisement -