Friday, February 24, 2012

Error in convert function

I use convert to work with Hijri functions
when i write
select convert (datetime,'29-10-1426',131)
the result is correct
2005-12-01 00:00:00.000

when I increase the date by one
select convert (datetime,'30-10-1426',131)
I get
Server: Msg 242, Level 16, State 3, Line 1
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

Why and how i solve itAs far as I know, the month 10 in Hijri calendar only has 29 days, so the second statement is supposed to fail. The next day to convert (datetime,'30-10-1426',131) is

select convert (datetime,'1-11-1426',131)

Regards,
Jun|||

The 10 month in Hijri calender is 30 days so
In Hijri calender any month can be 29 or 30 days
thanks

No comments:

Post a Comment