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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-11-13 : 08:02:42
|
| anil writes "I want to convert and compare two date which are in different date formats. I want to convert my variable into DD/MM/YY format.How can I do that?Pls help me for the same." |
|
|
SqlStar
Posting Yak Master
121 Posts |
Posted - 2003-11-13 : 08:51:02
|
| Hi,You can use CONEVRT or CAST function for this purpose. See books online.Ex:Select Convert(varchar(10), getdate(), 103)The above statement will give string output.":-) IT Knowledge is power :-)" |
 |
|
|
Stoad
Freaky Yak Linguist
1983 Posts |
Posted - 2003-11-13 : 09:05:49
|
| If you mean you have 2 strings like these:'22.03.2002' and '06/28/2003'and you want to compare them as dates then use this:convert(datetime, FirstDateString, 104)andconvert(datetime, SecondDateString, 101)PS See numeric options in Books Online. |
 |
|
|
SqlStar
Posting Yak Master
121 Posts |
Posted - 2003-11-13 : 09:11:27
|
| Yeah. If we know the EXACT date format for both date strings, we can use that.":-) IT Knowledge is power :-)" |
 |
|
|
|
|
|