i have a reminder section in program and I want to see some icon when 2 days before to remind

so i need to sort dates and i need to measure the time interval :)

how can i do this


thx for Answers :)

Recommended Answers

All 2 Replies

Dim isItTime As Boolean = False
Dim aDateFromReminder As DateTime = CDate("14.9.2011 7:00") ' This date comes from the reminder. I have to use Finnish datetime format
Dim timeInterval As Integer = 48 ' How much earlier you need to be reminded, the unit is hours

' Compare the reminder's date/time to current date time
If (aDateFromReminder.Subtract(Now).Hours <= timeInterval) Then
    isItTime = True
End If
' With the unit of hours, the precision is 2d + 1h in the code above
' If the time is now 12.9.2011 6:21, you would get a reminder (2d + 39 minutes)
' If you want more accuracy, change
' aDateFromReminder.Subtract(Now).Hours -> aDateFromReminder.Subtract(Now).Minutes
' and
' Dim timeInterval As Integer = 48 -> Dim timeInterval As Integer = 48 * 60 ' 2880 minutes

HTH

Wow u r awsome its exactly what i need Thx again :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.