I need to determine if a set of dates contain two different weeks.
For example:
When returning a set of records from a database that contain a date, there needs to be something to distinguish between the different weeks.
<cfloop query="datesExample">
<cfif DateDiff("d",DateFormat(lastDate),DateFormat(OriginalDate)) GTE 7>
<hr />
</cfif>
<p>#OrginalDate#</p>
<cfset lastDate = DateFormat(OrginalDate) />
</cfloop>
To me, this seems like all the logic I’d need to add to determine if there is a new week.
Although, I’m not getting any results from this.
Anyone have an ideas?
Update:
This is my actual if statement:
<cfif DayofWeek(lastShiftDate) NEQ DayOfWeek(Time_In) AND DateDiff("d",lastShiftDate, Time_In) GTE 7>
It was much more simple than what I thought. All I had to do was get the value of the first date. So,
<cfif query.RecordCount EQ 1><cfset firstDate = Now() /></cfif>and then do a dateDiff() with the lastShiftDateThanks for everyone’s help.