Solved

Finding out number of weeks by date range

Posted on 2006-07-23
6
987 Views
Last Modified: 2013-12-24
I have a record with a date range.  Is there a way to determine the number of weeks that is included in the date range?
0
Comment
Question by:moyedokun
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 11

Expert Comment

by:adonis1976
ID: 17165057
Say for example you have a record like 07/23/2006-07/20/2006

You can do something like this:

<cfset sDate = "07/23/2006-07/20/2006"

<cfset iWeeks = datediff(ww,listLast(sDate),listFirst(sDate))>

iWeeks should give you the difference in weeks..
0
 
LVL 13

Assisted Solution

by:usachrisk1983
usachrisk1983 earned 400 total points
ID: 17167364
Slight modification to one of your lines:

<cfset iWeeks = datediff(ww,listLast(sDate),listFirst(sDate))>

should be

<cfset iWeeks = datediff(ww,listLast(sDate,'-'),listFirst(sDate,'-'))>

If the data is stored as "07/23/2006-07/20/2006"

This is because both ListFirst and ListLast will be looking for a comma as a delim, and when it doesn't find one, will assume it's just a one item list.
0
 
LVL 11

Expert Comment

by:adonis1976
ID: 17168108
yep sir.. agree with you.. i was asleep when I wrote that code..
0
Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

 

Author Comment

by:moyedokun
ID: 17189930
I get an error.  It is telling me that ww is undefined.
0
 
LVL 15

Accepted Solution

by:
tim_cs earned 100 total points
ID: 17190916
Just need to put the ww between quotes

datediff("ww",   etc...
0
 
LVL 25

Expert Comment

by:dgrafx
ID: 17225702
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question