View Complete Post
I am using following code for Robert's Posted Code (Url:http://forums.asp.net/t/1142378.aspx) But this is for only calculate weekends saturday and sunday can any one tell me how I get Number of days between given two dates Monday to Friday.
private const int MONDAY = 1;
private const int TUESDAY = 2;
private const int WEDNESDAY = 3;
private const int THURSDAY = 4;
private const int FRIDAY = 5;
private const int SATURDAY = 6;
private const int SUNDAY = 7;
/// Observe that the method calculates by including the start day, but excludes the end day
/// <param name="startDate"></param>
/// <param name="endDate"></param>
private void GetWeekendDaysBetween(DateTime startDate, DateTime endDate,out int saturdays,out int sundays)
saturdays = -1;
sundays = -1;
if (endDate < startDate)
TimeSpan timeBetween = endDate.Subtract(startDate);
int weekendsBetween = timeBetween.Days / 7;
I have a calculated column in a list called Days Open. This column contains the number of days between today (Sysdate) and another column called the Effective Date. Therefore, if Sysdate is 11/16/2010 and the Effective Date is 10/14/2010,
how do I calculate the number of days between the two dates?
I tried using this formula: =TEXT(Sysdate-[Effective Date],"h")
and then I tried =INT(Sysdate-Effective Date) & TEXT(Sysdate-Effective Date, ":hh:mm")
Neither formula worked. I hope it is something real simple that I am missing here. Any help you can provide will be highly appreciated!
i need to know if, given a birth date, a person has more than x years. Thats mean, the client must entry a date in a textbox and i need to know if the persona has more than 18 years.
Thx in advance
have two text box on which I give two date input by using rapid
application development datepicker textbox. I have another text box on
which I wanna show the duration of those two text box date.I want to calculate total days of those to date. Can anyone please provide me a solution?
Working days - Mon-Fri and Working hours - 9 Am to 5 Pm
Thur, 14-Oct-10 11.30 Am Thur, 14-Oct-10 5.00 Am 5.30
Fri, 15-Oct-10 11.30 Am Mon, 18-Oct-10 5.00 Am 13.30
Mon, 18-Oct-10 11.30 Am Mon, 18-Oct-10 6.00 Am 5.30
I'm trying to calculate the yrs, months, days, hours, mins, seconds between two dates with sql server or c# (ive just used sql more).
I have some code below that I started, but I get some negative values for months, values over 31 for months, and there very well could be more issues. Honestly my math is not the greatest and Im just not sure how to fix it. I want the user to be able to enter their birthday and for it to calculate the yrs, months, days, hours, mins, and seconds they have been alive.
Any help would be great
SELECT DATEDIFF(YEAR,'10/16/1995',GETDATE()) AS Years,
((DATEDIFF(MONTH,'10/16/1995',GETDATE()))-(DATEDIFF(YEAR,'10/16/1995',GETDATE())*12)) AS 'Months',
(DATEDIFF(DAY,'10/16/1995',GETDATE()))-(DATEDIFF(MONTH,'10/16/1995',GETDATE())*30) AS 'Days',
(DATEDIFF(HOUR,'10/16/1995',GETDATE()))-(DATEDIFF(DAY,'10/16/1995',GETDATE())*24) AS 'Hours',
(DATEDIFF(MINUTE,'10/16/1995',GETDATE()))-(DATEDIFF(HOUR,'10/16/1995',GETDATE())*60) AS 'Minutes',
(DATEDIFF(SECOND,'10/16/1995',GETDATE()))-(DATEDIFF(MINUTE,'10/16/1995',GETDATE())*60) AS 'Seconds'
Is there any function to calculate number of business days in a month for a particular date. my input would be just a single date
I have tried searching all over the web for this logic. Got many but half of them did not match what i was looking for and half were malfunctioning.
I want to calculate business working hours between 2 datetime, where in I should be able to set the working hours as well as weekends and holidays should not be calculated.
Please help me guys... It will be a great help...
The past year has been full of uncertainty and change. A year ago, everything seemed to be falling into place. Windows XP was nearing final release. An RC version of the Microsoft . NET Framework was whetting our appetites for the final February release.
MSDN Magazine November 2002