Earlier today, Sam suggested that I wrap at least some of my surrounding date algorithms in a ColdFusion user defined function. Here is my UDF, GetSurroundingDates(), that wraps all those dates up in a struct and returns it:
Launch code in new window » Download code as text file »
Calling it:
Launch code in new window » Download code as text file »
... we get the following output:
| | | | ||
| | ![]() | | ||
| | | |
I put the DateFormat() calls inside of the GetSurroundingDates() ColdFusion UDF for ease of use, but honestly, these are just overkill to me. I enjoy working with numeric dates so I don't care that dates coming out of it would be numeric (would fail IsDate() method calls). Once you get comfortable with numeric dates, I would recommend stripping out those DateFormat() calls as they do nothing significant but add to processing overhead.
Download Code Snippet ZIP File
Comments (2) | Post Comment | Ask Ben | Permalink | Other Searches | Print Page
Using A Name Suffix In ColdFusion's CFMail Tag
Ask Ben: Truncating The Event Titles In A Calendar Display
good on yer, Ben,
the next step is submitting the UDF to cflib.org so it'll spread around the world for evermore (well, that's perhaps going a bit far but you get the idea...)
just a thought
Posted by barry.b on May 8, 2007 at 7:01 AM
Thank you who writes with that this code! Very helped!
Posted by Fokk on May 8, 2007 at 7:32 AM