Howdy,
I'm having an issue with my code and I can't seem to figure it out. I'm trying to make an alert system basically the program goes out to a site(rss feed) checks the time and if the alert is not older than 20 minutes (arbitrary number for coding purposes) then it displays a message (the feed details), But if it is older than 20 minutes then it doesn't display the alert.
So far I can not get the date time to compare the way I want it too. Let me post some of my code, it might be a bit of a mess since I've been going back and forth with it.
If Date.UtcNow.Subtract(System.TimeSpan.FromMinutes(20)) < xNode.selectSingleNode("pubDate").text Then
Messagebox.show("This is a new Alert Message")
Else
Messagebox.Show("No new Alerts")
End If
I am thinking it has something to do with the way my feed is putting in the Date Time and will need to hack the code a bit and fix the date time in it.
Perhaps there is a better way to do this? I'm not familiar with date.compare, but that might also be something useful.
I'm having an issue with my code and I can't seem to figure it out. I'm trying to make an alert system basically the program goes out to a site(rss feed) checks the time and if the alert is not older than 20 minutes (arbitrary number for coding purposes) then it displays a message (the feed details), But if it is older than 20 minutes then it doesn't display the alert.
So far I can not get the date time to compare the way I want it too. Let me post some of my code, it might be a bit of a mess since I've been going back and forth with it.
If Date.UtcNow.Subtract(System.TimeSpan.FromMinutes(20)) < xNode.selectSingleNode("pubDate").text Then
Messagebox.show("This is a new Alert Message")
Else
Messagebox.Show("No new Alerts")
End If
I am thinking it has something to do with the way my feed is putting in the Date Time and will need to hack the code a bit and fix the date time in it.
Perhaps there is a better way to do this? I'm not familiar with date.compare, but that might also be something useful.