Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# SQL-Server
Hi All,
 
I am converting varchar datatype to datetime but it is throwing out of range exception.
 
Below conversion is failing
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
20130430
20130104
20130604
20130512
20130507
20131115
20130328
20130318
 
Can anybody help me on this?
Posted 28-Jan-13 1:42am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

There is no February 29th in 2013.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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...
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 540
1 OriginalGriff 300
2 CPallini 290
3 ChauhanAjay 124
4 George Jonsson 120
0 OriginalGriff 6,474
1 Sergey Alexandrovich Kryukov 6,190
2 CPallini 5,180
3 George Jonsson 3,574
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 28 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100