Whatever message this page gives is out now! Go check it out!

DateCompare

Last update:
May 18, 2026

Description

Performs a full date/time comparison of two dates.

Returns

  • -1, if date1 is earlier than date2
  • 0, if date1 is equal to date2
  • 1, if date1 is later than date2

Category

Function syntax

DateCompare(date1, date2 [, datePart])

See also

Parameters

Parameter
Description
date1
Date/time object, in the range 100 AD-9999 AD.
date2
Date/time object, in the range 100 AD-9999 AD.
datePart
Optional. String. Precision of the comparison.
  • s-Precise to the second (default)
  • n-Precise to the minute
  • h-Precise to the hour
  • d-Precise to the day
  • m-Precise to the month
  • yyyy-Precise to the year

Usage

When passing a date/time object as a string, enclose it in quotation marks. Otherwise, it is interpreted as a numeric representation of a date/time object.

Example

<cfscript>
    Date1 = "{ts '2018-11-15 12:13:50'}";
    Date2 = "{ts '2018-10-15 11:13:50'}";
    Date3 = "{ts '2018-11-15 12:13:50'}";
    Date4 = "{ts '2019-11-15 12:13:50'}";
    Compare= DateCompare(Date1,Date2)
    Compare1= DateCompare(Date1,Date3)
    Compare2= DateCompare(Date1,Date4)
    writeOutput("date comparison is : " & Compare & "<br/>")
    writeOutput("date comparison is : " & Compare1 & "<br/>")
    writeOutput("date comparison is : " & Compare2 & "<br/>")
</cfscript>
Output
date comparison is : 1

date comparison is : 0

date comparison is : -1

Real-world uses of the DateCompare function

Event scheduling and conflict detection

Event management companies need to prevent double-booking venues and ensure proper event spacing. Multiple events could be scheduled for the same venue at overlapping times, leading to conflicts and customer dissatisfaction. Use DateCompare to check for scheduling conflicts before confirming bookings.
<!--- DateCompare: Event Scheduling & Conflict Detection --->
<cfscript>
    // Sample event requests for the day
    todaysEvents = [
        {"name": "Board Meeting", "start": "2024-10-25 09:00:00", "end": "2024-10-25 11:00:00", "room": "Conference A"},
        {"name": "Team Standup", "start": "2024-10-25 10:30:00", "end": "2024-10-25 11:00:00", "room": "Conference A"},
        {"name": "Client Presentation", "start": "2024-10-25 14:00:00", "end": "2024-10-25 15:30:00", "room": "Conference B"},
        {"name": "Training Session", "start": "2024-10-25 14:30:00", "end": "2024-10-25 16:00:00", "room": "Conference B"}
    ];
</cfscript>

<h1>📅 DateCompare: Event Scheduling Demo</h1>
<p><strong>Business Need:</strong> Prevent double-booking and detect scheduling conflicts</p>
<p><strong>Challenge:</strong> Multiple events could overlap, causing venue conflicts</p>
<p><strong>Solution:</strong> Use DateCompare() to automatically detect scheduling conflicts</p>
<hr>

<cfoutput>
    <h2>🏢 Today's Event Schedule</h2>
    <div style="background: ##e3f2fd; padding: 20px; border-radius: 8px;">
        <cfloop array="#todaysEvents#" index="event">
            <div style="background: white; padding: 15px; margin: 10px 0; border-radius: 5px; border-left: 4px solid ##007bff;">
                <h3 style="margin: 0;">#event.name#</h3>
                <p><strong>Time:</strong> #TimeFormat(event.start, "h:nn tt")# - #TimeFormat(event.end, "h:nn tt")#</p>
                <p><strong>Room:</strong> #event.room#</p>
            </div>
        </cfloop>
    </div>
    
    <h2>🔍 Conflict Detection Analysis</h2>
    <div style="background: ##f8f9fa; padding: 20px; border-radius: 8px;">
        <p><strong>Checking for scheduling conflicts...</strong></p>
        
        <cfloop from="1" to="#ArrayLen(todaysEvents)#" index="i">
            <cfloop from="#i+1#" to="#ArrayLen(todaysEvents)#" index="j">
                <cfscript>
                    event1 = todaysEvents[i];
                    event2 = todaysEvents[j];
                    
                    // Parse the datetime strings
                    event1Start = ParseDateTime(event1.start);
                    event1End = ParseDateTime(event1.end);
                    event2Start = ParseDateTime(event2.start);
                    event2End = ParseDateTime(event2.end);
                    
                    // Check for time conflicts using DateCompare
                    // Events conflict if they overlap in time AND use same room
                    timeConflict1 = DateCompare(event1Start, event2End, "n") LT 0;    // event1 starts before event2 ends
                    timeConflict2 = DateCompare(event2Start, event1End, "n") LT 0;    // event2 starts before event1 ends
                    
                    hasTimeOverlap = timeConflict1 AND timeConflict2;
                    sameRoom = event1.room EQ event2.room;
                    
                    hasConflict = hasTimeOverlap AND sameRoom;
                    
                    // Calculate overlap duration if there's a conflict
                    overlapStart = "";
                    overlapEnd = "";
                    overlapMinutes = 0;
                    
                    if (hasTimeOverlap) {
                        // Find the overlap period
                        laterStart = DateCompare(event1Start, event2Start, "n") GT 0 ? event1Start : event2Start;
                        earlierEnd = DateCompare(event1End, event2End, "n") LT 0 ? event1End : event2End;
                        
                        overlapStart = TimeFormat(laterStart, "h:nn tt");
                        overlapEnd = TimeFormat(earlierEnd, "h:nn tt");
                        overlapMinutes = DateDiff("n", laterStart, earlierEnd);
                    }
                </cfscript>
                
                <div style="padding: 15px; margin: 10px 0; border-left: 4px solid #hasConflict ? '##dc3545' : '##28a745'#; background: #hasConflict ? '##f8d7da' : '##d4edda'#;">
                    <h4>#event1.name# vs #event2.name#</h4>
                    
                    <cfif hasConflict>
                        <p><strong>🚨 CONFLICT DETECTED!</strong></p>
                        <p><strong>Room:</strong> #event1.room# (same room)</p>
                        <p><strong>Overlap:</strong> #overlapStart# - #overlapEnd# (#overlapMinutes# minutes)</p>
                        <p style="background: ##fff3cd; padding: 10px; border-radius: 5px; margin: 10px 0;">
                            <strong>📋 Action Required:</strong> 
                            <br>• Reschedule one event to a different time
                            <br>• Move one event to a different room
                            <br>• Contact organizers to resolve conflict
                        </p>
                    <cfelseif hasTimeOverlap AND NOT sameRoom>
                        <p><strong>⚠️ Time Overlap (Different Rooms)</strong></p>
                        <p><strong>Rooms:</strong> #event1.room# / #event2.room#</p>
                        <p><strong>Overlap:</strong> #overlapStart# - #overlapEnd# (#overlapMinutes# minutes)</p>
                        <p style="background: ##d1ecf1; padding: 10px; border-radius: 5px; margin: 10px 0;">
                            <strong>✅ No Conflict:</strong> Different rooms - events can proceed as scheduled
                        </p>
                    <cfelse>
                        <p><strong>✅ No Conflict</strong></p>
                        <p>Events are properly scheduled with no time overlap</p>
                    </cfif>
                    
                    <div style="background: ##f8f9fa; padding: 10px; border-radius: 5px; margin: 10px 0;">
                        <small>
                            <strong>DateCompare Results:</strong><br>
                            • Event1 start vs Event2 end: #DateCompare(event1Start, event2End, "n")# 
                            #DateCompare(event1Start, event2End, "n") LT 0 ? "(event1 starts before event2 ends)" : "(no overlap)"#<br>
                            • Event2 start vs Event1 end: #DateCompare(event2Start, event1End, "n")#
                            #DateCompare(event2Start, event1End, "n") LT 0 ? "(event2 starts before event1 ends)" : "(no overlap)"#
                        </small>
                    </div>
                </div>
            </cfloop>
        </cfloop>
    </div>
    
    <h2>📊 Schedule Summary</h2>
    <cfscript>
        totalEvents = ArrayLen(todaysEvents);
        conflictCount = 0;
        roomUsage = {};
        
        // Count conflicts and room usage
        for (i = 1; i LTE totalEvents; i++) {
            for (j = i+1; j LTE totalEvents; j++) {
                event1 = todaysEvents[i];
                event2 = todaysEvents[j];
                
                event1Start = ParseDateTime(event1.start);
                event1End = ParseDateTime(event1.end);
                event2Start = ParseDateTime(event2.start);
                event2End = ParseDateTime(event2.end);
                
                timeOverlap = (DateCompare(event1Start, event2End, "n") LT 0) AND (DateCompare(event2Start, event1End, "n") LT 0);
                sameRoom = event1.room EQ event2.room;
                
                if (timeOverlap AND sameRoom) {
                    conflictCount++;
                }
            }
            
            // Count room usage
            if (NOT StructKeyExists(roomUsage, todaysEvents[i].room)) {
                roomUsage[todaysEvents[i].room] = 0;
            }
            roomUsage[todaysEvents[i].room]++;
        }
    </cfscript>
    
    <div style="background: ##e8f5e8; padding: 20px; border-radius: 8px;">
        <div style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px;">
            <div style="background: white; padding: 15px; text-align: center; border-radius: 5px;">
                <h3>Total Events</h3>
                <h2 style="color: ##007bff;">#totalEvents#</h2>
            </div>
            <div style="background: white; padding: 15px; text-align: center; border-radius: 5px;">
                <h3>Conflicts</h3>
                <h2 style="color: #conflictCount GT 0 ? '##dc3545' : '##28a745'#;">#conflictCount#</h2>
            </div>
            <div style="background: white; padding: 15px; text-align: center; border-radius: 5px;">
                <h3>Rooms Used</h3>
                <h2 style="color: ##6f42c1;">#StructCount(roomUsage)#</h2>
            </div>
            <div style="background: white; padding: 15px; text-align: center; border-radius: 5px;">
                <h3>Status</h3>
                <h2 style="color: #conflictCount GT 0 ? '##dc3545' : '##28a745'#;">#conflictCount GT 0 ? 'NEEDS ATTENTION' : 'ALL CLEAR'#</h2>
            </div>
        </div>
        
        <h3 style="margin-top: 20px;">Room Utilization:</h3>
        <cfloop collection="#roomUsage#" item="room">
            <p><strong>#room#:</strong> #roomUsage[room]# event(s) scheduled</p>
        </cfloop>
    </div>
</cfoutput>

Subscription and membership expiry management

SaaS companies and membership organizations need to track subscription status and renewal periods. Manual tracking of thousands of subscription expiry dates leads to service interruptions and customer churn. Use DateCompare to automatically check subscription status and trigger renewal notifications.
<!--- DateCompare: Subscription & Membership Expiry Management --->
<cfscript>
    // Sample subscription data
    customers = [
        {"company": "TechCorp Inc", "plan": "Premium", "expiry": "2024-12-15", "monthlyFee": 299.99, "contact": "sarah@techcorp.com"},
        {"company": "StartupXYZ", "plan": "Basic", "expiry": "2024-10-20", "monthlyFee": 99.99, "contact": "mike@startupxyz.com"},
        {"company": "GlobalTech", "plan": "Enterprise", "expiry": "2024-09-30", "monthlyFee": 999.99, "contact": "admin@globaltech.com"},
        {"company": "InnovateCo", "plan": "Premium", "expiry": "2025-01-30", "monthlyFee": 299.99, "contact": "billing@innovateco.com"},
        {"company": "SmallBiz LLC", "plan": "Basic", "expiry": "2024-11-05", "monthlyFee": 99.99, "contact": "owner@smallbiz.com"}
    ];
    
    // Business rules
    warningDays = 30;     // Send renewal notice 30 days before expiry
    graceDays = 7;        // Grace period after expiry
</cfscript>

<h1>💳 DateCompare: Subscription Management Demo</h1>
<p><strong>Business Need:</strong> Automated subscription tracking and renewal notifications</p>
<p><strong>Challenge:</strong> Manual tracking leads to service interruptions and lost revenue</p>
<p><strong>Solution:</strong> Use DateCompare() to monitor subscription status and trigger actions</p>
<hr>

<cfoutput>
    <cfscript>
        today = Now();
        totalRevenue = 0;
        activeCount = 0;
        expiredCount = 0;
        warningCount = 0;
        graceCount = 0;
    </cfscript>
    
    <h2>📊 Subscription Status Dashboard</h2>
    <p><strong>Analysis Date:</strong> #DateFormat(today, "mmmm d, yyyy")#</p>
    
    <div style="background: ##f8f9fa; padding: 20px; border-radius: 8px;">
        <cfloop array="#customers#" index="customer">
            <cfscript>
                expiryDate = ParseDateTime(customer.expiry);
                warningDate = DateAdd("d", -warningDays, expiryDate);
                graceEndDate = DateAdd("d", graceDays, expiryDate);
                
                // Use DateCompare to determine subscription status
                todayVsExpiry = DateCompare(today, expiryDate, "d");
                todayVsWarning = DateCompare(today, warningDate, "d");
                todayVsGrace = DateCompare(today, graceEndDate, "d");
                
                daysUntilExpiry = DateDiff("d", today, expiryDate);
                
                // Determine status and styling
                if (todayVsExpiry GT 0) {
                    // Expired
                    if (todayVsGrace LE 0) {
                        // Still in grace period
                        status = "🟡 GRACE PERIOD";
                        statusColor = "##ffc107";
                        bgColor = "##fff3cd";
                        actionRequired = "Contact immediately - service may be suspended";
                        graceCount++;
                    } else {
                        // Beyond grace period
                        status = "🔴 EXPIRED";
                        statusColor = "##dc3545";
                        bgColor = "##f8d7da";
                        actionRequired = "Service suspended - requires immediate renewal";
                        expiredCount++;
                    }
                } else if (todayVsWarning GTE 0) {
                    // In warning period
                    status = "🟡 RENEWAL DUE";
                    statusColor = "##ffc107";
                    bgColor = "##fff3cd";
                    actionRequired = "Send renewal notification";
                    warningCount++;
                    totalRevenue += customer.monthlyFee;
                } else {
                    // Active subscription
                    status = "🟢 ACTIVE";
                    statusColor = "##28a745";
                    bgColor = "##d4edda";
                    actionRequired = "No action required";
                    activeCount++;
                    totalRevenue += customer.monthlyFee;
                }
            </cfscript>
            
            <div style="background: #bgColor#; padding: 20px; margin: 15px 0; border-radius: 8px; border-left: 5px solid #statusColor#;">
                <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;">
                    <div>
                        <h3 style="margin: 0;">#customer.company#</h3>
                        <p style="margin: 5px 0;"><strong>Plan:</strong> #customer.plan# | <strong>Monthly Fee:</strong> $#NumberFormat(customer.monthlyFee, "999.00")#</p>
                    </div>
                    <span style="background: white; padding: 8px 15px; border-radius: 15px; font-weight: bold; color: #statusColor#;">
                        #status#
                    </span>
                </div>
                
                <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px;">
                    <div>
                        <p><strong>Expiry Date:</strong> #DateFormat(expiryDate, "mmmm d, yyyy")#</p>
                        <p><strong>Days Until Expiry:</strong> #daysUntilExpiry#</p>
                        <p><strong>Contact:</strong> #customer.contact#</p>
                    </div>
                    
                    <div>
                        <h4>📅 DateCompare Analysis:</h4>
                        <div style="background: white; padding: 10px; border-radius: 5px; font-family: monospace; font-size: 0.9em;">
                            <p>Today vs Expiry: <strong>#todayVsExpiry#</strong> #todayVsExpiry GT 0 ? "(expired)" : todayVsExpiry LT 0 ? "(active)" : "(expires today)"#</p>
                            <p>Today vs Warning: <strong>#todayVsWarning#</strong> #todayVsWarning GTE 0 ? "(in warning period)" : "(not in warning)"#</p>
                            <cfif todayVsExpiry GT 0>
                                <p>Today vs Grace End: <strong>#todayVsGrace#</strong> #todayVsGrace LE 0 ? "(in grace)" : "(beyond grace)"#</p>
                            </cfif>
                        </div>
                    </div>
                </div>
                
                <div style="background: rgba(255,255,255,0.8); padding: 15px; border-radius: 5px; margin-top: 15px;">
                    <h4>📋 Action Required:</h4>
                    <p><strong>#actionRequired#</strong></p>
                    
                    <cfif status CONTAINS "GRACE">
                        <p style="background: ##fff3cd; padding: 10px; border-radius: 5px;">
                            📞 <strong>Urgent Contact:</strong> "Your subscription expired on #DateFormat(expiryDate, 'mmmm d')#. 
                            You have #DateDiff('d', today, graceEndDate)# days remaining in your grace period. 
                            Please renew to avoid service interruption."
                        </p>
                    <cfelseif status CONTAINS "EXPIRED">
                        <p style="background: ##f8d7da; padding: 10px; border-radius: 5px;">
                            🚨 <strong>Service Suspended:</strong> "Your subscription expired on #DateFormat(expiryDate, 'mmmm d')# 
                            and the grace period has ended. Please contact billing to restore service."
                        </p>
                    <cfelseif status CONTAINS "RENEWAL">
                        <p style="background: ##d1ecf1; padding: 10px; border-radius: 5px;">
                            📧 <strong>Renewal Reminder:</strong> "Your #customer.plan# subscription expires on #DateFormat(expiryDate, 'mmmm d')# 
                            (#abs(daysUntilExpiry)# days). Renew now to ensure uninterrupted service."
                        </p>
                    </cfif>
                </div>
            </div>
        </cfloop>
    </div>
    
    <h2>📈 Revenue & Analytics Summary</h2>
    <div style="background: ##e8f5e8; padding: 20px; border-radius: 8px;">
        <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin-bottom: 20px;">
            <div style="background: white; padding: 15px; text-align: center; border-radius: 8px;">
                <h3>Total Customers</h3>
                <h2 style="color: ##007bff;">#ArrayLen(customers)#</h2>
            </div>
            <div style="background: white; padding: 15px; text-align: center; border-radius: 8px;">
                <h3>Active</h3>
                <h2 style="color: ##28a745;">#activeCount#</h2>
            </div>
            <div style="background: white; padding: 15px; text-align: center; border-radius: 8px;">
                <h3>Renewal Due</h3>
                <h2 style="color: ##ffc107;">#warningCount#</h2>
            </div>
            <div style="background: white; padding: 15px; text-align: center; border-radius: 8px;">
                <h3>Grace Period</h3>
                <h2 style="color: ##fd7e14;">#graceCount#</h2>
            </div>
            <div style="background: white; padding: 15px; text-align: center; border-radius: 8px;">
                <h3>Expired</h3>
                <h2 style="color: ##dc3545;">#expiredCount#</h2>
            </div>
            <div style="background: white; padding: 15px; text-align: center; border-radius: 8px;">
                <h3>Monthly Revenue</h3>
                <h2 style="color: ##6f42c1;">$#NumberFormat(totalRevenue, "9,999")#</h2>
            </div>
        </div>
        
        <cfscript>
            // Calculate business metrics
            renewalRate = (activeCount + warningCount) / ArrayLen(customers) * 100;
            churnRisk = (graceCount + expiredCount) / ArrayLen(customers) * 100;
            revenueAtRisk = 0;
            
            for (customer in customers) {
                expiryComp = DateCompare(today, ParseDateTime(customer.expiry), "d");
                if (expiryComp GTE 0) {
                    revenueAtRisk += customer.monthlyFee;
                }
            }
        </cfscript>
        
        <h3>📊 Business Metrics:</h3>
        <div style="background: white; padding: 15px; border-radius: 5px;">
            <p><strong>Renewal Rate:</strong> #NumberFormat(renewalRate, "0.0")#%</p>
            <p><strong>Churn Risk:</strong> #NumberFormat(churnRisk, "0.0")#% (#graceCount + expiredCount# customers)</p>
            <p><strong>Revenue at Risk:</strong> $#NumberFormat(revenueAtRisk, "9,999.00")# per month</p>
            <p><strong>Next Review Date:</strong> #DateFormat(DateAdd("d", 1, today), "mmmm d, yyyy")#</p>
        </div>
    </div>
</cfoutput>

Employee timesheet and attendance validation

HR departments need to validate employee punch times and detect attendance policy violations. Manual timesheet review is time-consuming and prone to errors, leading to payroll inaccuracies. Use DateCompare to automatically validate punch times and detect policy violations.
<!--- DateCompare: Employee Timesheet & Attendance Validation --->
<cfscript>
    // Sample employee timesheet data
    employeeRecords = [
        {"name": "John Smith", "dept": "Engineering", "punchIn": "2024-10-24 08:55:00", "punchOut": "2024-10-24 17:05:00", "breakStart": "12:00:00", "breakEnd": "12:30:00"},
        {"name": "Jane Doe", "dept": "Marketing", "punchIn": "2024-10-24 09:15:00", "punchOut": "2024-10-24 17:30:00", "breakStart": "12:15:00", "breakEnd": "12:45:00"},
        {"name": "Mike Johnson", "dept": "Sales", "punchIn": "2024-10-24 08:30:00", "punchOut": "2024-10-24 16:45:00", "breakStart": "12:30:00", "breakEnd": "13:00:00"},
        {"name": "Sarah Wilson", "dept": "HR", "punchIn": "2024-10-24 09:05:00", "punchOut": "2024-10-24 18:15:00", "breakStart": "12:00:00", "breakEnd": "13:00:00"},
        {"name": "Robert Brown", "dept": "Finance", "punchIn": "2024-10-24 08:45:00", "punchOut": "2024-10-24 17:00:00", "breakStart": "12:00:00", "breakEnd": "12:30:00"}
    ];
    
    // Company policies
    standardStart = "09:00:00";
    standardEnd = "17:00:00";
    maxBreakMinutes = 60;
    standardBreakMinutes = 30;
    overtimeThreshold = 8; // hours
    lateGracePeriod = 5; // minutes
</cfscript>

<h1>⏰ DateCompare: Employee Timesheet Validation</h1>
<p><strong>Business Need:</strong> Accurate attendance tracking and policy compliance</p>
<p><strong>Challenge:</strong> Manual timesheet review leads to payroll errors and disputes</p>
<p><strong>Solution:</strong> Use DateCompare() to validate attendance and detect violations</p>
<hr>

<cfoutput>
    <h2>👥 Employee Attendance Analysis</h2>
    <p><strong>Review Date:</strong> October 24, 2024</p>
    <p><strong>Standard Hours:</strong> #TimeFormat(standardStart, "h:nn tt")# - #TimeFormat(standardEnd, "h:nn tt")#</p>
    
    <cfscript>
        totalEmployees = ArrayLen(employeeRecords);
        onTimeCount = 0;
        lateCount = 0;
        earlyCount = 0;
        overtimeCount = 0;
        policyViolations = 0;
    </cfscript>
    
    <div style="background: ##f8f9fa; padding: 20px; border-radius: 8px;">
        <cfloop array="#employeeRecords#" index="employee">
            <cfscript>
                // Parse times
                punchInTime = ParseDateTime(employee.punchIn);
                punchOutTime = ParseDateTime(employee.punchOut);
                
                // Extract time components for comparison
                actualStartTime = TimeFormat(punchInTime, "HH:nn:ss");
                actualEndTime = TimeFormat(punchOutTime, "HH:nn:ss");
                
                // Calculate break duration
                breakStart = ParseDateTime(employee.breakStart);
                breakEnd = ParseDateTime(employee.breakEnd);
                breakMinutes = DateDiff("n", breakStart, breakEnd);
                
                // Use DateCompare to check attendance compliance
                startComparison = DateCompare(actualStartTime, standardStart, "n");
                endComparison = DateCompare(actualEndTime, standardEnd, "n");
                
                // Determine attendance status
                lateArrival = startComparison GT 0;
                earlyArrival = startComparison LT 0;
                earlyDeparture = endComparison LT 0;
                lateDeparture = endComparison GT 0;
                
                // Check if within grace period for lateness
                lateMinutes = lateArrival ? DateDiff("n", ParseDateTime(standardStart), punchInTime) : 0;
                isWithinGrace = lateArrival AND lateMinutes LE lateGracePeriod;
                
                // Calculate total working hours (excluding break)
                totalMinutes = DateDiff("n", punchInTime, punchOutTime);
                workingHours = (totalMinutes - breakMinutes) / 60;
                
                // Determine status and styling
                hasViolation = false;
                statusMessages = [];
                
                if (lateArrival AND NOT isWithinGrace) {
                    arrayAppend(statusMessages, "Late arrival (" & lateMinutes & " min)");
                    hasViolation = true;
                    lateCount++;
                } else if (lateArrival AND isWithinGrace) {
                    arrayAppend(statusMessages, "Late but within grace (" & lateMinutes & " min)");
                } else if (earlyArrival) {
                    arrayAppend(statusMessages, "Early arrival (" & abs(DateDiff("n", punchInTime, ParseDateTime(standardStart))) & " min)");
                    earlyCount++;
                }
                
                if (earlyDeparture) {
                    arrayAppend(statusMessages, "Early departure (" & DateDiff("n", punchOutTime, ParseDateTime(standardEnd)) & " min)");
                    hasViolation = true;
                } else if (lateDeparture) {
                    arrayAppend(statusMessages, "Late departure (" & DateDiff("n", ParseDateTime(standardEnd), punchOutTime) & " min)");
                }
                
                if (breakMinutes GT maxBreakMinutes) {
                    arrayAppend(statusMessages, "Extended break (" & breakMinutes & " min)");
                    hasViolation = true;
                }
                
                if (workingHours GT overtimeThreshold) {
                    arrayAppend(statusMessages, "Overtime (" & NumberFormat(workingHours - overtimeThreshold, "0.00") & " hrs)");
                    overtimeCount++;
                }
                
                if (arrayLen(statusMessages) EQ 0) {
                    arrayAppend(statusMessages, "Standard compliance");
                    onTimeCount++;
                }
                
                if (hasViolation) {
                    policyViolations++;
                }
                
                // Styling based on compliance
                if (hasViolation) {
                    statusColor = "##dc3545";
                    bgColor = "##f8d7da";
                    statusIcon = "⚠️";
                } else if (workingHours GT overtimeThreshold OR earlyArrival) {
                    statusColor = "##17a2b8";
                    bgColor = "##d1ecf1";
                    statusIcon = "💪";
                } else {
                    statusColor = "##28a745";
                    bgColor = "##d4edda";
                    statusIcon = "✅";
                }
            </cfscript>
            
            <div style="background: #bgColor#; padding: 20px; margin: 15px 0; border-radius: 8px; border-left: 5px solid #statusColor#;">
                <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;">
                    <div>
                        <h3 style="margin: 0;">#employee.name#</h3>
                        <p style="margin: 5px 0;"><strong>Department:</strong> #employee.dept#</p>
                    </div>
                    <span style="background: white; padding: 8px 15px; border-radius: 15px; font-weight: bold; color: #statusColor#;">
                        #statusIcon# #hasViolation ? 'POLICY ISSUE' : 'COMPLIANT'#
                    </span>
                </div>
                
                <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px;">
                    <div>
                        <h4>🕒 Time Records</h4>
                        <p><strong>Punch In:</strong> #TimeFormat(punchInTime, "h:nn:ss tt")#</p>
                        <p><strong>Punch Out:</strong> #TimeFormat(punchOutTime, "h:nn:ss tt")#</p>
                        <p><strong>Break:</strong> #TimeFormat(breakStart, "h:nn tt")# - #TimeFormat(breakEnd, "h:nn tt")# (#breakMinutes# min)</p>
                        <p><strong>Total Hours:</strong> #NumberFormat(workingHours, "0.00")#</p>
                    </div>
                    
                    <div>
                        <h4>📊 DateCompare Analysis</h4>
                        <div style="background: white; padding: 10px; border-radius: 5px; font-family: monospace; font-size: 0.85em;">
                            <p>Start vs Standard: <strong>#startComparison#</strong> 
                            #startComparison GT 0 ? "(late)" : startComparison LT 0 ? "(early)" : "(on time)"#</p>
                            <p>End vs Standard: <strong>#endComparison#</strong>
                            #endComparison GT 0 ? "(late departure)" : endComparison LT 0 ? "(early departure)" : "(on time)"#</p>
                            <p>Break Duration: <strong>#breakMinutes# min</strong>
                            #breakMinutes GT maxBreakMinutes ? "(exceeds policy)" : "(within policy)"#</p>
                        </div>
                    </div>
                </div>
                
                <div style="background: rgba(255,255,255,0.8); padding: 15px; border-radius: 5px; margin-top: 15px;">
                    <h4>📋 Status Summary:</h4>
                    <cfloop array="#statusMessages#" index="message">
                        <p style="margin: 5px 0;">• #message#</p>
                    </cfloop>
                    
                    <cfif hasViolation>
                        <div style="background: ##fff3cd; padding: 10px; border-radius: 5px; margin: 10px 0;">
                            <strong>📝 HR Action Required:</strong>
                            <br>• Document policy violation in employee record
                            <br>• Schedule discussion with employee if pattern continues
                            <br>• Review department scheduling if multiple violations
                        </div>
                    <cfelseif workingHours GT overtimeThreshold>
                        <div style="background: ##d1ecf1; padding: 10px; border-radius: 5px; margin: 10px 0;">
                            <strong>💰 Payroll Note:</strong>
                            <br>• Process overtime pay: #NumberFormat(workingHours - overtimeThreshold, "0.00")# hours @ 1.5x rate
                            <br>• Verify manager approval for overtime
                        </div>
                    </cfif>
                </div>
            </div>
        </cfloop>
    </div>
    
    <h2>📈 Attendance Analytics Dashboard</h2>
    <div style="background: ##e8f5e8; padding: 20px; border-radius: 8px;">
        <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 15px; margin-bottom: 20px;">
            <div style="background: white; padding: 15px; text-align: center; border-radius: 8px;">
                <h3>Total Staff</h3>
                <h2 style="color: ##007bff;">#totalEmployees#</h2>
            </div>
            <div style="background: white; padding: 15px; text-align: center; border-radius: 8px;">
                <h3>Compliant</h3>
                <h2 style="color: ##28a745;">#onTimeCount#</h2>
            </div>
            <div style="background: white; padding: 15px; text-align: center; border-radius: 8px;">
                <h3>Late Arrivals</h3>
                <h2 style="color: ##dc3545;">#lateCount#</h2>
            </div>
            <div style="background: white; padding: 15px; text-align: center; border-radius: 8px;">
                <h3>Early Birds</h3>
                <h2 style="color: ##17a2b8;">#earlyCount#</h2>
            </div>
            <div style="background: white; padding: 15px; text-align: center; border-radius: 8px;">
                <h3>Overtime</h3>
                <h2 style="color: ##6f42c1;">#overtimeCount#</h2>
            </div>
            <div style="background: white; padding: 15px; text-align: center; border-radius: 8px;">
                <h3>Violations</h3>
                <h2 style="color: ##fd7e14;">#policyViolations#</h2>
            </div>
        </div>
        
        <cfscript>
            // Calculate metrics
            complianceRate = (onTimeCount / totalEmployees) * 100;
            violationRate = (policyViolations / totalEmployees) * 100;
            
            // Calculate payroll impact
            totalOvertimeHours = 0;
            totalLateMinutes = 0;
            
            for (emp in employeeRecords) {
                punchIn = ParseDateTime(emp.punchIn);
                punchOut = ParseDateTime(emp.punchOut);
                breakMins = DateDiff("n", ParseDateTime(emp.breakStart), ParseDateTime(emp.breakEnd));
                workHours = (DateDiff("n", punchIn, punchOut) - breakMins) / 60;
                
                if (workHours GT overtimeThreshold) {
                    totalOvertimeHours += (workHours - overtimeThreshold);
                }
                
                if (DateCompare(TimeFormat(punchIn, "HH:nn:ss"), standardStart, "n") GT 0) {
                    lateTime = DateDiff("n", ParseDateTime(standardStart), punchIn);
                    totalLateMinutes += lateTime;
                }
            }
            
            // Estimated costs (example rates)
            avgHourlyRate = 25.00;
            overtimeCost = totalOvertimeHours * avgHourlyRate * 1.5;
            productivityLoss = (totalLateMinutes / 60) * avgHourlyRate;
        </cfscript>
        
        <h3>📊 Performance Metrics:</h3>
        <div style="background: white; padding: 15px; border-radius: 5px; margin: 10px 0;">
            <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px;">
                <div>
                    <p><strong>Compliance Rate:</strong> #NumberFormat(complianceRate, "0.0")#%</p>
                    <p><strong>Violation Rate:</strong> #NumberFormat(violationRate, "0.0")#%</p>
                    <p><strong>Total Overtime Hours:</strong> #NumberFormat(totalOvertimeHours, "0.00")#</p>
                    <p><strong>Total Late Minutes:</strong> #totalLateMinutes#</p>
                </div>
                <div>
                    <p><strong>Overtime Cost:</strong> $#NumberFormat(overtimeCost, "999.00")#</p>
                    <p><strong>Productivity Loss:</strong> $#NumberFormat(productivityLoss, "999.00")#</p>
                    <p><strong>Total Impact:</strong> $#NumberFormat(overtimeCost + productivityLoss, "999.00")#</p>
                    <p><strong>Avg per Employee:</strong> $#NumberFormat((overtimeCost + productivityLoss) / totalEmployees, "99.00")#</p>
                </div>
            </div>
        </div>
    </div>
</cfoutput>

Medical appointment and healthcare scheduling

Healthcare providers need efficient appointment scheduling with proper buffer times and emergency slots. Overbooking and insufficient appointment spacing leads to patient wait times and staff stress. Use DateCompare to ensure proper appointment spacing and availability checking.
<!--- DateCompare: Medical Appointment & Healthcare Scheduling --->
<cfscript>
    // Sample appointment data for today
    scheduledAppointments = [
        {"patient": "Sarah Wilson", "type": "General Checkup", "time": "2024-10-25 09:00:00", "duration": 30, "provider": "Dr. Smith", "room": "Room 101"},
        {"patient": "Robert Brown", "type": "Cardiology Consult", "time": "2024-10-25 09:15:00", "duration": 45, "provider": "Dr. Johnson", "room": "Room 102"},
        {"patient": "Lisa Garcia", "type": "Physical Therapy", "time": "2024-10-25 10:00:00", "duration": 60, "provider": "Therapist Mike", "room": "PT Room 1"},
        {"patient": "John Davis", "type": "Blood Test", "time": "2024-10-25 09:30:00", "duration": 15, "provider": "Nurse Kelly", "room": "Lab"},
        {"patient": "Maria Rodriguez", "type": "Dermatology", "time": "2024-10-25 10:15:00", "duration": 30, "provider": "Dr. Williams", "room": "Room 103"},
        {"patient": "David Kim", "type": "Follow-up Visit", "time": "2024-10-25 11:00:00", "duration": 20, "provider": "Dr. Smith", "room": "Room 101"}
    ];
    
    // Scheduling policies
    minimumGapMinutes = 15;    // Minimum gap between appointments
    bufferForComplexMinutes = 10;  // Extra buffer for complex procedures
    maxOverbookingMinutes = 5;     // Acceptable overbooking tolerance
</cfscript>

<h1>🏥 DateCompare: Medical Appointment Scheduling</h1>
<p><strong>Business Need:</strong> Efficient patient scheduling with proper appointment spacing</p>
<p><strong>Challenge:</strong> Overbooking leads to long wait times and stressed healthcare staff</p>
<p><strong>Solution:</strong> Use DateCompare() to validate scheduling and optimize patient flow</p>
<hr>

<cfoutput>
    <h2>👩‍⚕️ Today's Appointment Schedule</h2>
    <p><strong>Schedule Date:</strong> October 25, 2024</p>
    <p><strong>Minimum Gap Policy:</strong> #minimumGapMinutes# minutes between appointments</p>
    
    <cfscript>
        totalAppointments = ArrayLen(scheduledAppointments);
        conflictCount = 0;
        properlySpacedCount = 0;
        overbookedCount = 0;
        totalRevenue = 0; // Placeholder for revenue calculation
    </cfscript>
    
    <div style="background: ##f8f9fa; padding: 20px; border-radius: 8px;">
        <cfloop array="#scheduledAppointments#" index="i" item="appointment">
            <cfscript>
                appointmentStart = ParseDateTime(appointment.time);
                appointmentEnd = DateAdd("n", appointment.duration, appointmentStart);
                
                // Initialize conflict tracking
                conflicts = [];
                roomConflicts = [];
                providerConflicts = [];
                hasAnyConflict = false;
                
                // Check against all other appointments
                for (j = 1; j LTE ArrayLen(scheduledAppointments); j++) {
                    if (j NEQ i) {
                        otherAppt = scheduledAppointments[j];
                        otherStart = ParseDateTime(otherAppt.time);
                        otherEnd = DateAdd("n", otherAppt.duration, otherStart);
                        
                        // Use DateCompare to check for time overlaps
                        timeOverlap1 = DateCompare(appointmentStart, otherEnd, "n") LT 0;
                        timeOverlap2 = DateCompare(otherStart, appointmentEnd, "n") LT 0;
                        
                        hasTimeOverlap = timeOverlap1 AND timeOverlap2;
                        
                        if (hasTimeOverlap) {
                            // Calculate overlap duration
                            overlapStart = DateCompare(appointmentStart, otherStart, "n") GT 0 ? appointmentStart : otherStart;
                            overlapEnd = DateCompare(appointmentEnd, otherEnd, "n") LT 0 ? appointmentEnd : otherEnd;
                            overlapMinutes = DateDiff("n", overlapStart, overlapEnd);
                            
                            // Check different types of conflicts
                            if (appointment.room EQ otherAppt.room) {
                                arrayAppend(roomConflicts, {
                                    "patient": otherAppt.patient,
                                    "type": "Room conflict",
                                    "overlap": overlapMinutes
                                });
                                hasAnyConflict = true;
                            }
                            
                            if (appointment.provider EQ otherAppt.provider) {
                                arrayAppend(providerConflicts, {
                                    "patient": otherAppt.patient,
                                    "type": "Provider conflict", 
                                    "overlap": overlapMinutes
                                });
                                hasAnyConflict = true;
                            }
                            
                            // General time conflict (for reference)
                            arrayAppend(conflicts, {
                                "patient": otherAppt.patient,
                                "type": "Time overlap",
                                "overlap": overlapMinutes,
                                "room": otherAppt.room,
                                "provider": otherAppt.provider
                            });
                        }
                    }
                }
                
                // Determine status and styling
                if (hasAnyConflict) {
                    if (ArrayLen(roomConflicts) GT 0 OR ArrayLen(providerConflicts) GT 0) {
                        status = "🚨 CRITICAL CONFLICT";
                        statusColor = "##dc3545";
                        bgColor = "##f8d7da";
                        conflictCount++;
                    } else {
                        status = "⚠️ SCHEDULING ISSUE";
                        statusColor = "##ffc107";
                        bgColor = "##fff3cd";
                        overbookedCount++;
                    }
                } else {
                    status = "✅ PROPERLY SCHEDULED";
                    statusColor = "##28a745";
                    bgColor = "##d4edda";
                    properlySpacedCount++;
                }
            </cfscript>
            
            <div style="background: #bgColor#; padding: 20px; margin: 15px 0; border-radius: 8px; border-left: 5px solid #statusColor#;">
                <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;">
                    <div>
                        <h3 style="margin: 0;">#appointment.patient#</h3>
                        <p style="margin: 5px 0;"><strong>Type:</strong> #appointment.type# | <strong>Duration:</strong> #appointment.duration# min</p>
                    </div>
                    <span style="background: white; padding: 8px 15px; border-radius: 15px; font-weight: bold; color: #statusColor#;">
                        #status#
                    </span>
                </div>
                
                <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px;">
                    <div>
                        <h4>📅 Appointment Details</h4>
                        <p><strong>Time:</strong> #TimeFormat(appointmentStart, "h:nn tt")# - #TimeFormat(appointmentEnd, "h:nn tt")#</p>
                        <p><strong>Provider:</strong> #appointment.provider#</p>
                        <p><strong>Location:</strong> #appointment.room#</p>
                        
                        <cfif ArrayLen(conflicts) GT 0>
                            <div style="background: white; padding: 10px; border-radius: 5px; margin: 10px 0;">
                                <strong>📊 DateCompare Analysis:</strong><br>
                                <cfloop array="#conflicts#" index="conflict">
                                    <small style="font-family: monospace; display: block; margin: 2px 0;">
                                    vs #conflict.patient#: #conflict.overlap# min overlap
                                    </small>
                                </cfloop>
                            </div>
                        </cfif>
                    </div>
                    
                    <div>
                        <h4>⚕️ Conflict Analysis</h4>
                        
                        <cfif ArrayLen(roomConflicts) GT 0>
                            <div style="background: ##f8d7da; padding: 10px; border-radius: 5px; margin: 5px 0;">
                                <strong>🏠 Room Conflicts:</strong><br>
                                <cfloop array="#roomConflicts#" index="conflict">
                                    <small>• vs #conflict.patient# (#conflict.overlap# min overlap)</small><br>
                                </cfloop>
                            </div>
                        </cfif>
                        
                        <cfif ArrayLen(providerConflicts) GT 0>
                            <div style="background: ##f8d7da; padding: 10px; border-radius: 5px; margin: 5px 0;">
                                <strong>👨‍⚕️ Provider Conflicts:</strong><br>
                                <cfloop array="#providerConflicts#" index="conflict">
                                    <small>• vs #conflict.patient# (#conflict.overlap# min overlap)</small><br>
                                </cfloop>
                            </div>
                        </cfif>
                        
                        <cfif NOT hasAnyConflict>
                            <div style="background: ##d4edda; padding: 10px; border-radius: 5px; margin: 5px 0;">
                                <strong>✅ No Scheduling Conflicts</strong><br>
                                <small>Appointment is properly spaced with adequate buffer time</small>
                            </div>
                        </cfif>
                    </div>
                </div>
                
                <div style="background: rgba(255,255,255,0.8); padding: 15px; border-radius: 5px; margin-top: 15px;">
                    <h4>📋 Recommended Actions:</h4>
                    
                    <cfif ArrayLen(roomConflicts) GT 0>
                        <div style="background: ##f8d7da; padding: 10px; border-radius: 5px; margin: 5px 0;">
                            <strong>🏠 ROOM CONFLICT RESOLUTION:</strong>
                            <br>• Move appointment to available room
                            <br>• Reschedule one appointment to different time
                            <br>• Contact patients to coordinate timing
                        </div>
                    </cfif>
                    
                    <cfif ArrayLen(providerConflicts) GT 0>
                        <div style="background: ##f8d7da; padding: 10px; border-radius: 5px; margin: 5px 0;">
                            <strong>👨‍⚕️ PROVIDER CONFLICT RESOLUTION:</strong>
                            <br>• Assign different qualified provider
                            <br>• Reschedule appointment to provider's available time
                            <br>• Adjust appointment duration if possible
                        </div>
                    </cfif>
                    
                    <cfif NOT hasAnyConflict>
                        <div style="background: ##d4edda; padding: 10px; border-radius: 5px; margin: 5px 0;">
                            <strong>✅ STANDARD PREPARATION:</strong>
                            <br>• Prepare examination room 15 minutes before appointment
                            <br>• Review patient chart and previous visit notes
                            <br>• Ensure all required equipment is available
                        </div>
                    </cfif>
                </div>
            </div>
        </cfloop>
    </div>
    
    <h2>📊 Schedule Optimization Dashboard</h2>
    <div style="background: ##e8f5e8; padding: 20px; border-radius: 8px;">
        <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 15px; margin-bottom: 20px;">
            <div style="background: white; padding: 15px; text-align: center; border-radius: 8px;">
                <h3>Total Appointments</h3>
                <h2 style="color: ##007bff;">#totalAppointments#</h2>
            </div>
            <div style="background: white; padding: 15px; text-align: center; border-radius: 8px;">
                <h3>Properly Scheduled</h3>
                <h2 style="color: ##28a745;">#properlySpacedCount#</h2>
            </div>
            <div style="background: white; padding: 15px; text-align: center; border-radius: 8px;">
                <h3>Minor Issues</h3>
                <h2 style="color: ##ffc107;">#overbookedCount#</h2>
            </div>
            <div style="background: white; padding: 15px; text-align: center; border-radius: 8px;">
                <h3>Critical Conflicts</h3>
                <h2 style="color: ##dc3545;">#conflictCount#</h2>
            </div>
            <div style="background: white; padding: 15px; text-align: center; border-radius: 8px;">
                <h3>Schedule Efficiency</h3>
                <h2 style="color: ##6f42c1;">#NumberFormat((properlySpacedCount / totalAppointments) * 100, "0")#%</h2>
            </div>
        </div>
        
        <cfscript>
            // Calculate scheduling metrics
            conflictRate = (conflictCount / totalAppointments) * 100;
            efficiencyRate = (properlySpacedCount / totalAppointments) * 100;
            
            // Analyze provider utilization
            providers = {};
            rooms = {};
            
            for (appt in scheduledAppointments) {
                if (NOT StructKeyExists(providers, appt.provider)) {
                    providers[appt.provider] = 0;
                }
                providers[appt.provider]++;
                
                if (NOT StructKeyExists(rooms, appt.room)) {
                    rooms[appt.room] = 0;
                }
                rooms[appt.room]++;
            }
            
            // Calculate average wait time impact
            totalConflictMinutes = 0;
            for (i = 1; i LTE ArrayLen(scheduledAppointments); i++) {
                for (j = i+1; j LTE ArrayLen(scheduledAppointments); j++) {
                    appt1Start = ParseDateTime(scheduledAppointments[i].time);
                    appt1End = DateAdd("n", scheduledAppointments[i].duration, appt1Start);
                    appt2Start = ParseDateTime(scheduledAppointments[j].time);
                    appt2End = DateAdd("n", scheduledAppointments[j].duration, appt2Start);
                    
                    if (DateCompare(appt1Start, appt2End, "n") LT 0 AND DateCompare(appt2Start, appt1End, "n") LT 0) {
                        overlapStart = DateCompare(appt1Start, appt2Start, "n") GT 0 ? appt1Start : appt2Start;
                        overlapEnd = DateCompare(appt1End, appt2End, "n") LT 0 ? appt1End : appt2End;
                        totalConflictMinutes += DateDiff("n", overlapStart, overlapEnd);
                    }
                }
            }
        </cfscript>
        
        <h3>📈 Performance Metrics:</h3>
        <div style="background: white; padding: 15px; border-radius: 5px; margin: 10px 0;">
            <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px;">
                <div>
                    <p><strong>Schedule Efficiency:</strong> #NumberFormat(efficiencyRate, "0.0")#%</p>
                    <p><strong>Conflict Rate:</strong> #NumberFormat(conflictRate, "0.0")#%</p>
                    <p><strong>Total Conflict Time:</strong> #totalConflictMinutes# minutes</p>
                    <p><strong>Avg Wait Impact:</strong> #NumberFormat(totalConflictMinutes / totalAppointments, "0.0")# min/patient</p>
                </div>
                <div>
                    <p><strong>Providers Scheduled:</strong> #StructCount(providers)#</p>
                    <p><strong>Rooms Utilized:</strong> #StructCount(rooms)#</p>
                    <p><strong>Target Efficiency:</strong> 95% (Current: #NumberFormat(efficiencyRate, "0")#%)</p>
                    <p><strong>Max Acceptable Conflicts:</strong> 5% (Current: #NumberFormat(conflictRate, "0")#%)</p>
                </div>
            </div>
        </div>
        
        <h3>👥 Resource Utilization:</h3>
        <div style="background: white; padding: 15px; border-radius: 5px; margin: 10px 0;">
            <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px;">
                <div>
                    <h4>Provider Schedule:</h4>
                    <cfloop collection="#providers#" item="provider">
                        <p><strong>#provider#:</strong> #providers[provider]# appointment(s)</p>
                    </cfloop>
                </div>
                <div>
                    <h4>Room Utilization:</h4>
                    <cfloop collection="#rooms#" item="room">
                        <p><strong>#room#:</strong> #rooms[room]# appointment(s)</p>
                    </cfloop>
                </div>
            </div>
        </div>
        
        <cfif conflictCount GT 0>
            <div style="background: ##f8d7da; padding: 15px; border-radius: 5px; margin: 10px 0;">
                <h4>🚨 Immediate Actions Required:</h4>
                <p><strong>Critical Conflicts:</strong> #conflictCount# appointment(s) need immediate rescheduling</p>
                <p><strong>Estimated Wait Time:</strong> +#NumberFormat(totalConflictMinutes / 2, "0")# minutes average</p>
                <p><strong>Recommended:</strong> Contact affected patients within 2 hours</p>
            </div>
        <cfelse>
            <div style="background: ##d4edda; padding: 15px; border-radius: 5px; margin: 10px 0;">
                <h4>✅ Schedule Status: Optimal</h4>
                <p><strong>All Appointments:</strong> Properly spaced with adequate buffer time</p>
                <p><strong>Patient Experience:</strong> Minimal wait times expected</p>
                <p><strong>Staff Efficiency:</strong> Optimal workflow maintained</p>
            </div>
        </cfif>
    </div>
</cfoutput>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page