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 |
|
deadfish
Starting Member
38 Posts |
Posted - 2003-03-21 : 02:33:56
|
| I would like to convert a string with the format '23/2/2003' to datetime. How to do this?Thanks! |
|
|
harshal_in
Aged Yak Warrior
633 Posts |
Posted - 2003-03-21 : 03:11:33
|
quote: I would like to convert a string with the format '23/2/2003' to datetime. How to do this?Thanks!
hi,you can use cast() as: select cast('2/03/2003' as datetime)Regards,Harshal.Expect the UnExpected |
 |
|
|
deadfish
Starting Member
38 Posts |
Posted - 2003-03-21 : 04:17:22
|
| It works! Thanks Harshal!Edited by - deadfish on 03/21/2003 04:20:47 |
 |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2003-03-21 : 07:09:15
|
| It works?! I am surprised...CAST('02/03/2003' AS DateTime) might work, but CAST('23/03/2003' AS DateTime) should give you an error, since all CAST operations to Datetime, need the value to be in mm/dd/yyyy format. That is not so obvious with a value like '02/03/2003'. OS |
 |
|
|
|
|
|