M
Mike
I use c#, V2005
How I can get difference between two dates and get value in month(s)
I had found some solutions but it is not exactly what I need.
private static int monthDifference(DateTime startDate, DateTime
endDate)
{
int monthsApart = 12 * (startDate.Year - endDate.Year) +
startDate.Month - endDate.Month;
return Math.Abs(monthsApart);
}
on this way I can get int values.
For me is important to get value for full and half month, for e.g. 1
month and 15 days…
1 month, 1.5 month, 2, 2.5, 3, 3.5 etc. Actually, I want to get some
values from 15 days to 12 months and cover all possibilities 15 days
+15 days +15 days+
something like this: 15 days, 30, 45, 60, …etc.
Is that possible
How I can get difference between two dates and get value in month(s)
I had found some solutions but it is not exactly what I need.
private static int monthDifference(DateTime startDate, DateTime
endDate)
{
int monthsApart = 12 * (startDate.Year - endDate.Year) +
startDate.Month - endDate.Month;
return Math.Abs(monthsApart);
}
on this way I can get int values.
For me is important to get value for full and half month, for e.g. 1
month and 15 days…
1 month, 1.5 month, 2, 2.5, 3, 3.5 etc. Actually, I want to get some
values from 15 days to 12 months and cover all possibilities 15 days
+15 days +15 days+
something like this: 15 days, 30, 45, 60, …etc.
Is that possible