Do you work at Microsoft? :)
-----Original Message-----
From: Bryan Love [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 04, 2002 3:56 PM
To: CF-Talk
Subject: RE: Reverse Engineer DayOfYear Function?
<cfscript>
theYear = year(now()); // or whatever...
janEnd = 31;
febEnd = janEnd + 28;
if( isLeapYear(theYear) )
febEnd = febEnd + 1;
marEnd = febEnd + 31;
aprEnd = marEnd + 30;
mayEnd = aprEnd + 31;
junEnd = mayEnd + 30;
julEnd = junEnd + 31;
augEnd = julEnd + 31;
sepEnd = augEnd + 30;
octEnd = sepEnd + 31;
novEnd = octEnd + 30;
decEnd = novEnd + 31;
// figure out the date
if( theDay LTE janEnd )
theDate = "1/#theDay#/#theYear#";
else if( theDay LTE febEnd ){
newDay = theDay - janEnd;
theDate = "2/#newDay#/#theYear#";
}
else if( theDay LTE marEnd ){
newDay = theDay - febEnd;
theDate = "3/#newDay#/#theYear#";
}
else if( theDay LTE aprEnd ){
newDay = theDay - marEnd;
theDate = "4/#newDay#/#theYear#";
}
else if( theDay LTE mayEnd ){
newDay = theDay - aprEnd;
theDate = "5/#newDay#/#theYear#";
}
else if( theDay LTE junEnd ){
newDay = theDay - mayEnd;
theDate = "6/#newDay#/#theYear#";
}
else if( theDay LTE julEnd ){
newDay = theDay - junEnd;
theDate = "7/#newDay#/#theYear#";
}
else if( theDay LTE augEnd ){
newDay = theDay - julEnd;
theDate = "8/#newDay#/#theYear#";
}
else if( theDay LTE sepEnd ){
newDay = theDay - augEnd;
theDate = "9/#newDay#/#theYear#";
}
else if( theDay LTE octEnd ){
newDay = theDay - sepEnd;
theDate = "10/#newDay#/#theYear#";
}
else if( theDay LTE novEnd ){
newDay = theDay - octEnd;
theDate = "11/#newDay#/#theYear#";
}
else if( theDay LTE decEnd ){
newDay = theDay - novEnd;
theDate = "12/#newDay#/#theYear#";
}
</cfscript>
+-----------------------------------------------+
Bryan Love
Macromedia Certified Professional
Internet Application Developer
Database Analyst
TeleCommunication Systems
[EMAIL PROTECTED]
+-----------------------------------------------+
"...'If there must be trouble, let it be in my day, that my child may have
peace'..."
- Thomas Paine, The American Crisis
-----Original Message-----
From: Christian Abad [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 04, 2002 12:52 PM
To: CF-Talk
Subject: Reverse Engineer DayOfYear Function?
Folks:
I am trying to obtain a date from the ordinal produced by the function
DayOfYear. In other words, does anyone know how to "reverse engineer" the
ordinal into a usable date? I would assume I'd need to pass the ordinal and
the year to some function to obtain a usable date. I can't seem to find a
function that will accomplish this! Any ideas?
Thanks,
Christian N. Abad
--------------------------------------
Sr. Analyst - Apps Programming
Bank of America
eCommerce Technology - Website Support
http://www.bankofamerica.com
______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists