Last post May 04, 2010 06:05 AM by Ravihimanshu
Mar 23, 2010 11:48 AM|Ozo|LINK
I have start and finish time. For exampe; start time is 15.01.2010 anf finish time 03.02.2010. I want to day on the month. For example;
If I select january I wantto calculate 15 days , If I select fabruary I want to calculate 3days.
Mar 23, 2010 02:42 PM|JeromeP|LINK
It might be me, but your post made no sense.
Could you try to describe more what you're tying to do ? What is you "select" march, what do you want to get ?
Mar 23, 2010 04:04 PM|Ozo|LINK
I have two date from training start and finish time. Example the training start time: 17.01.2010 and finish time 03.02.2010. When I select january in my list I want to showi I attend in this month 13 days and if i select fabruary I will attend this tarining
3 day. I hope, I will explain my problem
Mar 23, 2010 04:11 PM|MetalAsp.Net|LINK
You should to be able to make use of DateTime.DaysInMonth() to get the total number of days in a month, then subtract that from your actual day of your date. Good luck!
Mar 25, 2010 09:57 AM|venkata kishore|LINK
u want to exclude saturday, sunday or u want to include both ?
Apr 20, 2010 11:14 AM|sirdneo|LINK
This query will give you a good start
select last_day(start_date)-start_date days_of_jan from (select
to_date('15.01.2010', 'dd.mm.yyyy') start_date,
to_date('03.02.2010', 'dd.mm.yyyy') end_date
Apr 21, 2010 05:01 AM|noelablon|LINK
don't get the question too.
Do you mean, if you select January, you will be informed that you have training on the 17th of January and if you choose February, you will be informed that you will have training on the 3rd?
You want to calculate the days between those two dates (January 17 up to Feb 1)?
May 04, 2010 06:05 AM|Ravihimanshu|LINK
DateTime dtTo, dtFrom;
dtTo = Convert.ToDateTime(<Ending date>);
dtFrom = Convert.ToDateTime(<starting date>);
// write switch case statement .for January the following code might work.
DateTime dtJan = Convert.ToDateTime("01/31/2010");
if (dtJan > dtFrom)
dtTo = dtJan;
if (dtJan < dtTo)
dtFrom = dtJan;
TimeSpan diff1 = dtTo.Subtract(dtFrom);
add 1 day to the diff1 for calculating exact number of days of training. if you select Jan for the training start date 17.01.2010, ther difference between 17.01.2010 and 31.01.2010 is 14 i.e. excluding day 17, so you need to add one more day. so the actual
number of days will be 15.
hope this will help you.