Date compare .. Is it the DATE OLDER than 72 hours ago?

J

jc

RE: Date compare .. Is it the DATE OLDER than 72 hours ago?

I've got a gridview with a label column with text that looks like
this..

12/12/2007 11: 07:25 AM

I am able to Change type that into a datetime field.

Dim GridDate As Date =
CDate(GridOrders.Rows(dgItem.RowIndex).Cells(2).Text)

While I loop through the gridview to determine if to make a button
visible or not I need to check if the date in that cell is OLDER than
72 hours ago? Or if easier, if the date is older than 3 days ago.

meaning 12/9/2007 would not qualify, if today is 12/12/2007.

How can I do this in VB.NET?

thanks for any help or information.
 
A

Armin Zingler

jc said:
RE: Date compare .. Is it the DATE OLDER than 72 hours ago?

I've got a gridview with a label column with text that looks like
this..

12/12/2007 11: 07:25 AM

I am able to Change type that into a datetime field.

Dim GridDate As Date =
CDate(GridOrders.Rows(dgItem.RowIndex).Cells(2).Text)

While I loop through the gridview to determine if to make a button
visible or not I need to check if the date in that cell is OLDER
than 72 hours ago? Or if easier, if the date is older than 3 days
ago.

meaning 12/9/2007 would not qualify, if today is 12/12/2007.

How can I do this in VB.NET?

thanks for any help or information.


If Date.Now.Subtract(GridDate).TotalHours > 72 Then

Don't know how you want to handle partial days. This also takes the hours
into account.


Armin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top