I was on the way to the bathroom (the Tea has to go somewhere) when this popped into my head: Since dates in ColdFusion are represented as floating numbers and the decimal represents the time of day, you can use ColdFusion's Rand() function to generate random times. Think about it; since Rand() gets a value that is between 0 and 1, this can be thought of as between 12:00 AM one day and 12:00 AM the next (1 = 12:00 AM of the next day).
Here's a little test:
<cfloop index="intI" from="1" to="10" step="1"> #TimeFormat( Rand(), "hh:mm TT" )# </cfloop>
Running the above code, we get:
Well anyway, this is really not that useful, but you never know. You might come up against a situation where picking random times is critical?? Good to know that this can easily be done.
Want to use code from this post? Check out the license.