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.
5 1753
Seeing as how you already have the date, why do you need to format it into a string?
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.
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. -
Year(drequest) & Right("0" & Month(drequest), 2)
-
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. -
Year(drequest) & Right("0" & Month(drequest), 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 ;)
Yeah, week().. that's what I meant.
Good luck.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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)...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
| |