Determining if given DateTime is older than a Hour
-
Hi All I am really struggeling with DateTime Formats. I have an incoming table of data coming in.It is constantly busy. I am writing a monitor system on this table.So what I want to do is retrieve the last entries dateTime. SELECT TOP(1) DateTime FROM TABLE ORDER BY DateTime DESC. What I want to know is: How do I determine if the DateTime I received is older than 1 Hour from DateTime.Now AND Ex How do I determine if the DateTime I received is older than 5 Minutes from DateTime.Now OR EX How do I determine if the DateTime I received is older than 1Hour.5 Minutes from DateTime.Now Thanks a million in advanced
-
Hi All I am really struggeling with DateTime Formats. I have an incoming table of data coming in.It is constantly busy. I am writing a monitor system on this table.So what I want to do is retrieve the last entries dateTime. SELECT TOP(1) DateTime FROM TABLE ORDER BY DateTime DESC. What I want to know is: How do I determine if the DateTime I received is older than 1 Hour from DateTime.Now AND Ex How do I determine if the DateTime I received is older than 5 Minutes from DateTime.Now OR EX How do I determine if the DateTime I received is older than 1Hour.5 Minutes from DateTime.Now Thanks a million in advanced
-
Hi All I am really struggeling with DateTime Formats. I have an incoming table of data coming in.It is constantly busy. I am writing a monitor system on this table.So what I want to do is retrieve the last entries dateTime. SELECT TOP(1) DateTime FROM TABLE ORDER BY DateTime DESC. What I want to know is: How do I determine if the DateTime I received is older than 1 Hour from DateTime.Now AND Ex How do I determine if the DateTime I received is older than 5 Minutes from DateTime.Now OR EX How do I determine if the DateTime I received is older than 1Hour.5 Minutes from DateTime.Now Thanks a million in advanced
it is not clear whether you want an SQL or a VB.NET approach. Maybe this article[^] gets you going. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
-
Hi All I am really struggeling with DateTime Formats. I have an incoming table of data coming in.It is constantly busy. I am writing a monitor system on this table.So what I want to do is retrieve the last entries dateTime. SELECT TOP(1) DateTime FROM TABLE ORDER BY DateTime DESC. What I want to know is: How do I determine if the DateTime I received is older than 1 Hour from DateTime.Now AND Ex How do I determine if the DateTime I received is older than 5 Minutes from DateTime.Now OR EX How do I determine if the DateTime I received is older than 1Hour.5 Minutes from DateTime.Now Thanks a million in advanced
Its very simple Use DateDiff Function First Argument is the Difference Interval See the
DateInterval
enumeration(has hours, seconds etc.) The Second Argument is the date you retrieve The Third Argument is the current date(Date.Now) The code will be likeDim hours As Long = DateDiff(DateInterval.Hour, retrievedDate, Date.Now)
-
Its very simple Use DateDiff Function First Argument is the Difference Interval See the
DateInterval
enumeration(has hours, seconds etc.) The Second Argument is the date you retrieve The Third Argument is the current date(Date.Now) The code will be likeDim hours As Long = DateDiff(DateInterval.Hour, retrievedDate, Date.Now)