Click here to Skip to main content
15,886,035 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
Hi All,

I am converting varchar datatype to datetime but it is throwing out of range exception.

Below conversion is failing
C#
SELECT CAST('20130229' as DATETIME)
SELECT CONVERT(DATETIME,'20130229')

But it is working fine for the other date. Some date are given below for which it is working fine
VB
20130430
20130104
20130604
20130512
20130507
20131115
20130328
20130318


Can anybody help me on this?
Posted

There is no February 29th in 2013.
 
Share this answer
 
You try to display the date 29th feb 2013 , but in 2013 calender is not a leapyear how to display the date 29. please be concentrate on this...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900