VB has many built-in functions are very practical, very good, this article on the DateDiff to introduce!
1, function functions:
Returns the time interval between two dates.
Example:
DateDiff("D", now, thedate)
D stands for Day (day) now is the current time, Thedate is a time we define ourselves
The result of the entire function, then, is the difference in date between the custom time and the current time.
(By the way will be commonly used to enumerate, s seconds, M minutes, H hours, D-day, N-month, y-year)
Based on this function, we're going to make a release time that shows how long ago the effect
<%
Limit=datediff ("s", "2009-1-17 9:05:35", "2009-1-17 10:05:55")
Response. Write limit& "Seconds"
Response. Write ("
if (limit <) then show_t = "just"
if (limit >= and limit < 3600) Then show_t = INT (LIMIT/60) & "Minutes Ago"
if (limit >= 3600 and limit < 86400) then show_t = INT (limit/3600) & "Hours Ago"
if (limit >= 86400 and limit < 2592000) then show_t = INT (limit/86400) & "Days Ago"
if (limit >= 2592000 and limit < 31104000) then show_t = INT (limit/2592000) & "months ago"
If limit >= 31104000 then show_t = "long time ago ... A big gray wolf ... "
Response. Write (show_t)
%>