in my databasae table i have to coloumn
one coloumn for issueDate and one for leaveDate
i get issueDate and LeaveDate from database and show them in textbox
But the problem is
i want to get on no of days
for example
issue date =12/12/2014
leave date=12/10/2012
reamin=12-10=2
i want this kindly tell me how i can get only only days from textbox and calculate there difference??????????
Bhushan GawalePosted Jan 18, 2015, 1:05 AM
In such cases - it is highly recommended that you should always try to read the values in the UTC date time format and pass it as string to the server, which then parses the UTC string to give you DateTime object.
Read more info about converting date time to UTC here - http://praveenlobo.com/techblog/how-to-convert-javascript-local-date-to-utc-and-utc-to-local-date/
The server code should look something like this
DateTime dateTime = DateTime.Parse(utcDateString,CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal);
Now about calculating the date difference - Its better to use the Linq providers like this
int diffDays = System.Data.Linq.SqlClient.SqlMethods.DateDiffDay(date1, date2);
Md. Raskinur RashidPosted Jan 18, 2015, 12:21 AM
VulpesPosted Jan 17, 2015, 2:19 PM