vb.net - DateDiff doesn’t work with nullables -


i’m trying find difference between nullable dates. datediff(dateinterval.day, firstdate, seconddate) works date, not nullable(of date). both dates nullable fields.

this error message:

overload resolution failed because no accessible datediff can called without narrowing conversion:

  • public function datediff(interval string, date1 object, date2 object, [dayofweek microsoft.visualbasic.firstdayofweek = firstdayofweek.sunday], [weekofyear microsoft.visualbasic.firstweekofyear = firstweekofyear.jan1]) long: argument matching parameter interval narrows microsoft.visualbasic.dateinterval string.

  • public function datediff(interval microsoft.visualbasic.dateinterval, date1 date, date2 date, [dayofweek microsoft.visualbasic.firstdayofweek = firstdayofweek.sunday], [weekofyear microsoft.visualbasic.firstweekofyear = firstweekofyear.jan1]) long: argument matching parameter date1 narrows date? date.

  • public function datediff(interval microsoft.visualbasic.dateinterval, date1 date, date2 date, [dayofweek microsoft.visualbasic.firstdayofweek = firstdayofweek.sunday], [weekofyear microsoft.visualbasic.firstweekofyear = firstweekofyear.jan1]) long: argument matching parameter date2 narrows date? date.

if know they’re not nothing, values:

datediff(dateinterval.day, firstdate.value, seconddate.value) 

but can take advantage of operator overloading, since isn’t vb6:

(seconddate.value - firstdate.value).days 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -