Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
"Value of '20.1.2012 0:00:00' is not valid for 'Value'. 'Value' should be between 'MinDate' and 'MaxDate'.\r\nParameter name:Value"
The problem is that the 'MinDate' is set up as '1.1.0001 0:00:00', and the 'MaxDate' is '31.12.9999 23:59:59'.
Does anyone see what is the problem, and how it occured?
Posted

Check your culture: Is your date format set to accept "." as a date part separator? If it isn't, then 20.1.2012 is not a valid date, but 20/1/2012 may be.
 
Share this answer
 
v2
Comments
developercorei3 20-Jan-12 5:26am    
The date and time format is dd.MM.yyyy. What could it be?
developercorei3 24-Jan-12 9:31am    
I have checked culture on both computers (on first is Sharepoint application, and on second is Database of that application). On first is English regional settings, and on second is Serbian regional settings. Is this the source of the problem?

P.S. I can't change this without authorization, because there are a large ammount of important data.
OriginalGriff 24-Jan-12 10:39am    
Probably yes - I don't know anything about sharepoint, but most databases use ISO format "yyyy-MM-dd" unless you tell them not to.
You need to look at trying to use the equivalent of the .NET DateTime class instead of using string conversions - they always cause pain!
You can specify the exact input and output format when converting dates to / from strings in C# / VB code (I assume it is the same in Sharepoint).
developercorei3 25-Jan-12 5:17am    
This database is set to use Latin regional settings (I have tried to use English regional settings, and there is another problem, so we would stick to Latin).
DateTime dateValue = DateTime.Now;


Use like this in query
'" + dateValue.ToString("MM/dd/yyyy hh:mm:ss tt") + "'
 
Share this answer
 
v2
Comments
developercorei3 20-Jan-12 5:28am    
That solution would cause a lot of problem, because base.CustomFormat = "dd.MM.yyyy";
Do you have another suggestion?

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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