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
 SQL Server Development (2000)
 Convert Date Format

Author  Topic 

vpathisseril
Starting Member

6 Posts

Posted - 2003-10-29 : 13:37:15
I am trying to convert a date formats:
Date to MMDDYYYY
I know how to convert to YYYYMMDD as follows.
select (convert(char(8), p.check_date,112)) from temp
output:
YYYYMMDD
20030912

I want my out should be MMDDYYYY
Any suggestions greatly appreciated.
Thanks

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2003-10-29 : 13:44:03
select replace(convert(varchar(10),getdate(),101),'/','')
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-10-29 : 13:48:03
[code]
DECLARE @x varchar(26), @y varchar(26)
SELECT @x=CONVERT(varchar(26), GetDate(), 112)
SELECT @y = SUBSTRING(@x,5,2)+SUBSTRING(@x,7,2)+SUBSTRING(@x,1,4)
SELECT @y

[/code]

I like his better...by far...





Brett

8-)
Go to Top of Page

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2003-10-29 : 13:52:05
There goes brett trying to up his posts again. LOL

Jim
Users <> Logic
Go to Top of Page
   

- Advertisement -