Click here to Skip to main content
15,904,416 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
Currenly i did only application in asp.net 3.5 with c#. completed project & hosted in server (Server located in INDIA) and all users using it without any issue.
Now the same application required for someother team. so they gave new server and ask me to host (Server located in USA). But while i hosted and testing application i get following error in convertion of datetime.

The conversion of a varchar data type to a datetime data type resulted in an out-of-range value


dateformat : mm/dd/yyyy hh:mmPM/AM
Example : 12/21/2011 1:30PM

Hope its not coding issue. if so it must appear while i host in INDIA server itself.
Please help me.
Posted

 
Share this answer
 
May be issue with the time zone settings,

go through the below link, this will help you

Here[^]

Thanks
--RA
 
Share this answer
 
v2
XML
hi all, i find an alternate solution.

my current query :
<pre>CONVERT(VARCHAR,BIS_RequestMaster.RequestDate,101) + ' ' + CONVERT(VARCHAR,BIS_RequestMaster.RequestTime,100) AS RequestDate</pre>

changed to :
<pre>CONVERT(DATETIME,(CONVERT(VARCHAR,BIS_RequestMaster.RequestDate,101) + ' ' + CONVERT(VARCHAR,BIS_RequestMaster.RequestTime,100)),101) AS RequestDate</pre>

i dont know whats this :( but want to change in all place of my code. is this the only solution :((
 
Share this answer
 
I faced the same issue. Its related to culture settings in the server. The datetime formats will differ according to cultures.


Use the en-US culture settings in web.config which will over ride the server culture settings

<globalization uiCulture="en" culture="en-US" />


Also you will need to correct the date formats for the dates already stored in the database

( In my case , one of the server had en-US and the other had en-AU settings)
 
Share this answer
 
v4
Thanks for your reply Zorro.
But my column is perfect date & time format.
To explain more i have two columns (I m using sql server 2008)

"Column 1" as date format
"Column 2" as time format

i m bringing final solution as Column 1 + Column 2 to bring the result as 12/21/2011 1:30PM

everything working fine with INDIA Server. But throwing error while hosting application in USA server.

Help me plz
 
Share this answer
 
Comments
Rajesh Anuhya 19-Jan-12 5:34am    
Don't post your comment here, post under the related answer, so that member will get a email.

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