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 - 2001-03-08 : 15:01:08
|
sugu writes "I've worked myself into a corner!
I need to test to see if a string date (in the form 'mm/dd/yyyy') is valid. I will be doing this in a stored procedure. Any suggestions?" |
|
|
rrb
SQLTeam Poet Laureate
1479 Posts |
Posted - 2002-01-08 : 21:21:40
|
| That's fine for the US where you use mm/dd/yyyy...But ISDATE() doesn't work for dd/mm/yyyy which is what we use in the rest of the world!egISDATE('24/2/2001') returns 0 even though this is a valid date ISDATE('2/24/2001') returns 1 even though this is garbage where I live...I assume we (ie most of the world's population) will have to manually transform the string of the form dd/mm/yyyy to mm/dd/yyyy before I use ISDATE() - Oh Joy.Unless someone has a better suggestion?mad dogs and englishmen...Edited by - rrb on 01/08/2002 21:23:53 |
 |
|
|
byrmol
Shed Building SQL Farmer
1591 Posts |
Posted - 2002-01-08 : 21:27:45
|
| rrb,You are right that the rest of the world uses dd/mm/yyyy.However the whole world is wrong!!!!!!!Use ISO Date formats eg yyyymmdd etc... and there will NEVER be a problem.. What the user sees and the database sees can be two different things..Capture your dates in the middle tier or DB and convert to ISO...DavidMTomorrow is the same day as Today was the day before. |
 |
|
|
rrb
SQLTeam Poet Laureate
1479 Posts |
Posted - 2002-01-08 : 21:36:48
|
| Thanks for that, and in an ideal world I would. Unfortunately, scum-suckers like me are at the receiving end of that "middle-tier" of which you speak. And I have two chances of getting that changed before Christmas 2002, and neither of them are good...mad dogs and englishmen... |
 |
|
|
|
|
|