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 |
msrs
32 Posts |
Posted - 2008-08-21 : 03:59:57
|
Hi all,How to treat this date format in sql server '22-oct-00'any function is there to find out.(sql treat this year 00 as 2000 or 3000) Thanks&Regards,Msrs |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-08-21 : 04:00:58
|
select cast('22-oct-00' as datetime)MadhivananFailing to plan is Planning to fail |
 |
|
msrs
32 Posts |
Posted - 2008-08-21 : 04:23:51
|
i am giving date format like this select cast('22-oct-99' as datetime)this will display :1999-10-22 00:00:00.000Previous centuryselect cast('22-oct-20' as datetime) this will display :2020-10-22 00:00:00.000present centuryit will take the range from 0-49 Previous centuryand 50-99 present century.Thanks&Regards,Msrs |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-21 : 04:27:36
|
quote: Originally posted by msrs i am giving date format like this select cast('22-oct-99' as datetime)this will display :1999-10-22 00:00:00.000Previous centuryselect cast('22-oct-20' as datetime) this will display :2020-10-22 00:00:00.000present centuryit will take the range from 0-49 Previous centuryand 50-99 present century.Thanks&Regards,Msrs
thats how sql server interprets it. have you had a look at books online reagrding cast & convert?the below is from BOLBy default, SQL Server interprets two-digit years based on a cutoff year of 2049. That is, the two-digit year 49 is interpreted as 2049 and the two-digit year 50 is interpreted as 1950. Many client applications, such as those based on Automation objects, use a cutoff year of 2030. SQL Server provides the two digit year cutoff configuration option that changes the cutoff year used by SQL Server and allows for the consistent treatment of dates. We recommend specifying four-digit years. |
 |
|
|
|
|