This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfset numbers=[8,6,9,4,5,3,1,2]> | |
<cfset largest= numbers[1]> | |
<cfloop from="2" to="#arraylen(numbers)#" index="i"> | |
<cfif numbers[i] GT largest> | |
<cfset largest=numbers[i]> | |
</cfif> | |
</cfloop> | |
</cflist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
var now = now(); | |
var date = '2024-02-23 06:45:41'; | |
var x = ( hour(now) - hour(date) ); | |
dump(x) | |
</cfscript> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
/* | |
This is INCORRECT | |
A capitol 'D' will return the day in the year | |
*/ | |
writeOutput(dateTimeFormat(now(), 'YYYY-MM-DD')); | |
writeOutput("<br/>"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
// Build up a new query. Notice that we are using the augmented | |
// features of ColdFusion 10 and the queryNew() to build complex | |
// queries in one command. | |
friends = queryNew( | |
"id, name, last, phone, add1, add2, city, state, zip", | |
"cf_sql_integer, cf_sql_varchar, cf_sql_varchar, cf_sql_varchar, cf_sql_varchar, cf_sql_varchar, cf_sql_varchar, cf_sql_varchar, cf_sql_varchar", | |
[ | |
[ 1, "Tricia", "Someone", "1112223333", "1223 main st", "apt 2", "Somewhere", "FL", "12345" ] | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfset age = 18> | |
<cfif age GT 18> | |
You are an adult. | |
<cfelseif age LT 18> | |
You are a minor. | |
<cfelse > | |
You are 18. | |
</cfif> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfset age = 18> | |
<cfif age GE 18> | |
You are an adult. | |
<cfelseif age LE 18> | |
You are a minor. | |
<cfelse > | |
You are 18. | |
</cfif> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cffunction name="businessDaysBetween" returntype="numeric" access="public"> | |
<cfargument name="startDate" type="date" required="true"> | |
<cfargument name="endDate" type="date" required="true"> | |
<cfargument name="ukHolidays" type="array" required="true"> | |
<cfset var businessDays = 0> | |
<cfset var allDays = DateDiff("d", startDate, endDate)> | |
<cfset var checkDate = startDate> | |
<cfloop index="i" from="1" to="#allDays#"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cffunction name="businessDaysBetween" returntype="numeric" access="public"> | |
<cfargument name="startDate" type="date" required="true"> | |
<cfargument name="endDate" type="date" required="true"> | |
<cfargument name="ukHolidays" type="array" required="true"> | |
<cfset var businessDays = 0> | |
<cfset allDays = DateDiff("d", startDate, endDate)> | |
<cfloop index="i" from="0" to="#allDays - 1#"> | |
<cfset businessDays = businessDays + 1> | |
</cfloop> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cffunction name="businessDaysBetween" returntype="numeric" access="public"> | |
<cfargument name="startDate" type="date" required="true"> | |
<cfargument name="endDate" type="date" required="true"> | |
<cfargument name="ukHolidays" type="array" required="true"> | |
<cfset var businessDays = 0> | |
<cfset allDays = DateDiff("d", startDate, endDate)> | |
<cfloop index="i" from="0" to="#allDays#"> | |
<cfset businessDays = businessDays + 1> | |
</cfloop> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cffunction name="businessDaysBetween" returntype="numeric" access="public"> | |
<!--- // Your code goes here ---> | |
</cffunction> | |
<!--- Define UK Holidays for 2024 ---> | |
<cfset ukHolidays = [ | |
<!--- 2024 UK Bank Holidays ---> | |
createDate(2024, 1, 1), <!--- New Year's Day ---> | |
createDate(2024, 3, 29), <!--- Good Friday ---> | |
createDate(2024, 4, 1), <!--- Easter Monday ---> | |
createDate(2024, 5, 6), <!--- Early May Bank Holiday ---> |
NewerOlder