I’m looking for a way to loop over a give time ran...
# cfml-beginners
m
I’m looking for a way to loop over a give time range. lets say 9:00 AM to 5:00 PM, increments of 5 minutes. I’ve found the Adobe docs on how to do this using tag syntax but I was hoping someone would know how to translate into in script syntax. Adobe Docs: https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-j-l/cfloop-looping-over-a-date-or-time-range.html
r
Have you tried it in https://cfscript.me/?
m
I have not. Thanks for the tip.
r
It should convert it for you or at least get you very close to the script syntax.
m
Got it! Thanks again for the help. I’m going to leave this here in case anyone comes looking for something similar:
Copy code
var start = createTime( 9, 0, 0 );
var end   = createTime( 17, 00, 0 );
for ( i = start; i <= end; i = dateAdd( 'n', 5, i ) ) {
    writeDump( var = i );
}
p
Def would have been a good test to attempt at converting yourself to cfscript and giving it a whirl. Tags are a thing of the past.