Page 1 of 1

Datediff problem

Posted: Thu Jul 08, 2010 2:29 am
by whythetorment
Hi,

Im trying to do the equivalent of this in stimulsoft, but the result is coming back as -36
SELECT datediff(n, '2002-11-06 10:30:00.00', '2002-11-11 13:06:00.000')

The result in SQL is 7356

I've used this in stimulsoft :

DateDiff(DataSource1.ClaimDate, DataSource1.DteLastSent).Minutes

ClaimDate is '2002-11-06 10:30:00.00' and DteLastSent is '2002-11-11 13:06:00.000'

Thanks

Datediff problem

Posted: Thu Jul 08, 2010 8:01 am
by Jan
Hello,

We use following code for DateDiff function:

Code: Select all

public static TimeSpan? DateDiff(DateTime? date1, DateTime? date2)
		{
			if (date1.HasValue && date2.HasValue)
				return date1.Value.Subtract(date2.Value);
			else
				return null;
		}
Unfortunately we can't change somthing now because this function is used in reports of our customers.

Thank you.

Datediff problem

Posted: Thu Jul 08, 2010 8:17 am
by Brendan
Hi,

you can try the following:

Code: Select all

{DateDiff(DataSource1.DteLastSent, DataSource1.ClaimDate).TotalMinutes}
This switches the order you pass in your date parameters and uses TotalMinutes instead of Minutes

Datediff problem

Posted: Thu Jul 08, 2010 8:31 am
by whythetorment
Thanks, the TotalMinutes option worked.