Advertisement
6_2008-2009 Databases/ Data Access/ DAO/ ADO #197715

Code of the Day Database (updated)

I started this application in order to gather somewhere all the code I receive every day from Planet Source Code (actually I gather the URL’s). There are a lot of improvements in this version, plus some bug fixes. Some of these are: importing PSC e-mails directly from the net, importing PSC e-mails from Outlook, better error handling and trace routines. Check out readme.htm for more details. The database now contains e-mails from Dec 14 1999 until Jun 19 2000. I have change (again) the database, so be careful.

AI

สรุปโดย AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

ซอร์สโค้ด
original-source
Upload
<% @ LANGUAGE = VBScript %>
<% Option Explicit %>
<%
'##############################################
'## Function Name: GetAGE()
'## 
'## Description: This function will take an
'## input date and calculate the age in years
'## of how old someone is or age of an item
'## to the current Date.
'##
'## Inputs: A valid date ex: 04/25/2000
'##
'## Returns: Integer - AGE in YEARS
'##     NULL If invalid input 
'##
'## Notes: Calculation of a year is based upon
'##  the most accurate formula which states
'##  a Year = 365.242222 Days(Tropical Season). 
'##  An error of 1 day will occur every 40,000
'##  years with this formula.
'##
'## If the Julian formula is used then
'##  A Year = 365.25 days, which means every 
'##  128 years an Error of 1 Day will occur.
'##
'## If the Gregorian formula is used then
'##  A Year = 365.2425, which is fairly accurate
'##  But every 3200 years an Error of 1 day will
'##  occur.
'##############################################
Function GetAGE(dtmDate)
	Dim intAGE
	
	If IsDate(dtmDate) <> True Then
		GetAGE = "NULL"
		Exit Function
	End If
	 
	intAGE = DateDiff("d", dtmDate, Date)
	Response.Write "AGE is " & intAGE & "<br>"
	
	If IsNumeric(intAGE) Then
		intAGE = Int(Round(Abs(intAGE) / 365.242222, 4))
	End If
	GetAGE = intAGE
End Function

'----------------------------------
Dim dtmDate
dtmDate = "4/24/1875"
Response.Write "AGE is " & GetAGE(dtmDate) & "<br>"
%>
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine