将char数据类型转换为datetime数据类型会导致日期时间值超出范围。该语句已终止。 [英] The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. The statement has been terminated.

查看:145
本文介绍了将char数据类型转换为datetime数据类型会导致日期时间值超出范围。该语句已终止。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友,

在我的项目中有很多日期时间选择器在那里。如果我使用标准格式itz全天工作。但如果我使用自定义格式并且我选择了将来的日期,我会收到此错误。



错误:

char数据的转换键入日期时间数据类型导致超出范围的日期时间值。

该语句已被终止。





请解决我的问题。





谢谢&问候

Hi Friend,
in my project so many date time pickers is there.If i'm using standard format itz working all days. But if i'm using custom format and i selected future date i got this error.

Error:
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
The statement has been terminated.


please solve my problem.


Thanks & Regards

推荐答案

根据文档 [ ^ ] 日期时间值类型表示日期和时间,其值范围为1月1日午夜1点,1点,000 Anno Domini(公共时代)到公元9999年12月31日晚上11:59:59。( / i>



您要转换的字符串的内容是什么?
According to the documentation[^] The DateTime value type represents dates and times with values ranging from 12:00:00 midnight, January 1, 0001 Anno Domini (Common Era) through 11:59:59 P.M., December 31, 9999 A.D. (C.E.).

What is the content of the string that you are trying to convert?


您拥有的自定义格式是什么用过的 ?



此错误有两种情况,



1)当您尝试转换为超出限制时日期是0001年到9999年



2)当你试图转换为任何无效日期(比如第14个月或第32个日期)。



在大多数情况下,第二种情况是罪魁祸首,检查你的日期格式,甚至考虑你的文化。





如果帮助你,则标记为答案。
What is custom format you have used ?

this error comes in two scenarios,

1) when you try to convert to out of limit date which is year 0001 to 9999

2) when you try to convert to any invalid date (like to month 14, or date 32).

in most of the cases the second scenario is the culprit, check your date format, even consider your culture.


mark as answer if helped you.


这篇关于将char数据类型转换为datetime数据类型会导致日期时间值超出范围。该语句已终止。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆