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)
 Undocumented CONVERT???

Author  Topic 

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2010-01-28 : 19:28:38
Hi there

I wanted to get mm/dd/yy using CONVERT but did not get very far. BUt by chance when using CONERT(varchar(8), s.StartDate, 1) I got just what I needed but this style of 1 is not documented anywhere. Am I missing something here or is it documented somewhere? Or is this an Easter egg?


<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2010-01-28 : 19:58:10
It is documented in my copy of Books Online. It's the US standard of mm/dd/yyyy.


=======================================
Few things are harder to put up with than the annoyance of a good example. (Mark Twain)
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-01-29 : 03:53:33
"but this style of 1 is not documented anywhere"

As Bustaz Kool says its in the SQL DOCs "Books Online", specifically on the page about the CONVERT() function

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

Sachin.Nand

2937 Posts

Posted - 2010-01-29 : 04:47:30
select CONVERT(varchar(10),getdate(), 1)
returns 01/29/10
select CONVERT(varchar(10),getdate(), 101)
returns 01/29/2010

PBUH
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-01-29 : 07:49:34
In BOL, refer this ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/a87d0850-c670-4720-9ad5-6f5a22343ea8.htm

Madhivanan

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

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2010-01-29 : 11:41:28
Thanks folks must be going blind :(

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page
   

- Advertisement -