Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to find out how many days ago it was submitted.. 1

Status
Not open for further replies.

snowboardr

Programmer
Feb 22, 2002
1,401
PH
I need a way to look at a date of when a report was submited and if it was less then 3 days ago, it will show a "new" image..

I know how to show the image, but im not sure how to find out how many days ago it was by a date like 7/10/2002.
 
need some more details. is the report being stored in a database? if so, are you timestamping when the insert is done? "Where's the Ka-Boom? There's supposed to be an Earth-shattering Ka-Boom!"
Marvin the Martian
 
Im inserting 7/10/2002 into a table called "date"
 
I would use the datediff function, like this

<%
Dim Ddiffer
Ddiffer = DateDiff(&quot;yyyy&quot;, Now, &quot;07/10/2002&quot;)
' returns 0
if Ddiffer < 3 then
response.write &quot;It is under!&quot; & Ddiffer
end if
%> [bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
sorry wrote that backwards, that one returns -3

this way
DateDiff(&quot;yyyy&quot;, 07/10/2002, Date)
[bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
I think its

DateDiff(&quot;d&quot;, 07/10/2002, Date)

because you should look at day right not year?

 
the question was for 3 years so instead of messing with days yyyy returns the difference in years.
for example
DOB = &quot;12/16/1999&quot;
response.write dateDiff(&quot;yyyy&quot;,DOB,Date())
returns 3

SO
if dateDiff(&quot;yyyy&quot;,DOB,Date()) < 3 then
whatever
end if

incase you didn't know the DateDiff intervals used in the function
yyyy = year
q = quarter
m = month
y = day of year
d = day
w = week day
ww = week of the year
h = hour
n = minutes
s = seconds [bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
[flush2]oops!
3 days
very, very bad onpnt

anyway I hope that helped out!

[bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
thanks for the star snowboardr

and now that I know I'm too tired to read I am going to sleep.[sleeping] [bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top