VB.Net Days Between Dates -


i'm trying calculate days have passed between today , date in past using following code:

 caseopendays.text = (datetime.now.subtract(cdate(datereported.text))) 

where caseopendays label , datereported.text label.

i'm having error thrown:

value of type 'system.timespan' cannot converted 'string'

what missing here?

you have use timespan.days or timespan.totaldays:

dim timesincereporting timespan = datetime.now - cdate(datereported.text) caseopendays.text = cint(timesincereporting.totaldays).tostring() 

another way timespan.tostring:

caseopendays.text = timesincereporting.tostring("dd") 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -