المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : strange errror while parsing string to datetime in c#



C# Programming
11-20-2009, 01:00 PM
hi dudes,i have an application written by c#,visual studio 2008,my database file is an access db.i have a maskedtextbox that user enters the date,(short date as 1388/02/15-it's persian date),i parse the string to date,and i insert some data into my database,icluding the parsed date.furthermore i want to update or insert records which their date is between that date and a month later.so after parsing the entered string into date,i seperate its year,month and day, so i can add a day in farsi calender format.everything's going right until in the loop i reach the date which is '1388/02/30', i get an exception which says 'string was not recognized as a valid dattime'.where's the problem? why all the days has not any problem while that specific day has the problem? i traced the application and i'm sure the string that is being parsed while the exception raises,is 1388/02/30.
more desc:in persian (farsi) calender,6 first monthes of the year has 31 days,and the 6 last monthes has 30 days.