473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Is there an easier way to do week range?

Hi, I was wondering if there's an easier way to get a week range than what I'm currently using. Right now I use something along these lines, where drequest is the date

Format([drequest],"yyyy") & IIf(Format([drequest],"ww")<10,"0" & Format([drequest],"ww"),Format([drequest],"ww"))

this would be an example criteria for it to find out all dates between weeks 7 and 35

between 200607 and 200635

The biggest problem I have with this is if I just do
Format([drequest],"yyyyww")
any week before the 10th week wont put a 0 in front of it and then you end up with numbers like 20067.

Anyway, just wondering if there's an easier way.
Aug 6 '07 #1
5 1753
Rabbit
12,516 Expert Mod 8TB
Seeing as how you already have the date, why do you need to format it into a string?
Aug 6 '07 #2
Seeing as how you already have the date, why do you need to format it into a string?
Because we go by ship weeks here and weeks vary depending on the year, I've created a report that goes off of week instead of date to help the users enter data in a format they understand instead of having to look up what the beginning and end of each week is every time.

An example is august 6th this year falls on the week from august 5th to the 11th, next year it will fall on the week of august 3rd to the 9th, the year after that will be the 2nd to the 8th, and so on.
Aug 6 '07 #3
Rabbit
12,516 Expert Mod 8TB
drequest is a date though right? Where does that come from if they enter date in a text format?

This will give you the same results.
Expand|Select|Wrap|Line Numbers
  1. Year(drequest) & Right("0" & Month(drequest), 2)
  2.  
Aug 6 '07 #4
drequest is a date though right? Where does that come from if they enter date in a text format?

This will give you the same results.
Expand|Select|Wrap|Line Numbers
  1. Year(drequest) & Right("0" & Month(drequest), 2)
  2.  
that wont give the same thing, I'm using "ww" for weeks, not "mm" for months, however, I can substitute the week in there and that should work, thanks ;)
Aug 6 '07 #5
Rabbit
12,516 Expert Mod 8TB
Yeah, week().. that's what I meant.

Good luck.
Aug 6 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much...
9
by: mchen716 | last post by:
Hi, I have the following query: SELECT p.employee_code, p.employee_name, CONVERT(VARCHAR(12),t.tran_date,101) AS TranDate, CONVERT(VARCHAR(12),t.post_date,101) AS PostDate, SUM(tobill_hrs) AS...
4
by: Mark | last post by:
Hi I have been trying to convert the week number to a range of dates that I can use. It should be fairly simple for you guru's out there but for us mere mortals it is beyond our grasp. I know...
14
by: deko | last post by:
This runs, but does not narrow to current week. suggestions appreciated! SELECT lngEid, dtmApptDate, Subject, Appt_ID FROM qry002 WHERE (dtmApptDate BETWEEN DateAdd("d",-weekday()+2,) And...
9
by: Ray | last post by:
I need to convert the normal calendar to show the week no., the period no. and the financial year. The financial year format is as follows:- Date start: 2 May, 2005 7 days a week, 4 weeks a...
3
by: Tim Chase | last post by:
I've been trying to come up with a good algorithm for determining the starting and ending dates given the week number (as defined by the strftime("%W") function). My preference would be for a...
6
by: aarklon | last post by:
Hi folks, I found an algorithm for calculating the day of the week here:- http://www.faqs.org/faqs/calendars/faq/part1/index.html in the section titled 2.5 what day of the week was 2 august...
0
by: Killer42 | last post by:
Originally posted by sashi Generate Random Password ' Form code - frmPasswordGenerate Private Declare Function GetTickCount Lib "kernel32" () As Long Public Function PassGen(nLen As Long)...
1
by: Hetal | last post by:
I am working on Visual Basic 2003 and i had a question about date functions. Is there a way to get the date range for a week based on the combination of 1) Week of the year and 2) Year? I mean, is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.