Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / August 2005



Tip: Looking for answers? Try searching our database.

Searching by week of the year function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lawrence TMM - 30 Aug 2005 19:24 GMT
Hello,

Is there a function that allows me to search by the week number?  What I
mean is, there are 52 weeks in the year, is there a function where I can
enter week number 12, and CF will search on dates that fall within that week
of the year without me having to know what those dates are?

Signature

Lawrence TMM

Lawrence TMM - 30 Aug 2005 19:32 GMT
As a follow up, I know there is a function where I can enter a date and
retrieve the week number if falls in - Week(date) - I'm looking for one that
sort of works the other way around - something like this  - WeekDates(week
number,year) This would return two variables - the starting Sunday date and
the ending Saturday date.  If there isn't one like this, there should be.
:-)

Thanks!

Lawrence TMM

> Hello,
>
> Is there a function that allows me to search by the week number?  What I
> mean is, there are 52 weeks in the year, is there a function where I can
> enter week number 12, and CF will search on dates that fall within that
> week of the year without me having to know what those dates are?
mxstu - 30 Aug 2005 19:55 GMT
If this is for a database search, you may want to check your database
documentation for its set of functions.  For CF, you could use or adapt the
http://www.cflib.org/udf.cfm?ID=543 UDF from cflib.org.  

<!---- must download "weekStartDate" UDF first --->
<cfset firstOfWeek = weekStartDate(6, 2005)>
<cfset lastOfWeek = DateAdd("d", 6, firstOfWeek)>
<cfoutput>
Start: #DateFormat(firstOfWeek, "ddd mmm dd, yyyy")# <br>
End: #DateFormat(lastOfWeek, "ddd mmm dd, yyyy")#
</cfoutput>
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.