473,387 Members | 1,590 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.

WeekNumber?

I have a DB where each record had a Date field. I know in Excel you can use
the Weeknum() function to get the ISO week number for a given date.
Is there a way add a field in a Table that takes the date and converts it to
the week number?

Thanks in advance for any help!

Rusty
Nov 13 '05 #1
4 9161
RustyR wrote:
I have a DB where each record had a Date field. I know in Excel you can use
the Weeknum() function to get the ISO week number for a given date.
Is there a way add a field in a Table that takes the date and converts it to
the week number?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I don't know if it gives the ISO week number, but the DatePart()
function can return the week of the year:

DatePart("ww", Date())

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQkHnMIechKqOuFEgEQJEywCfUU2t3T7y9ClyQ4JOazlHMh G8SS4AoN/7
3eZa4p8Bsr0tn8jbGdY6xfHU
=tiTe
-----END PGP SIGNATURE-----
Nov 13 '05 #2
On Wed, 23 Mar 2005 15:19:56 -0600, RustyR wrote:
I have a DB where each record had a Date field. I know in Excel you can use
the Weeknum() function to get the ISO week number for a given date.
Is there a way add a field in a Table that takes the date and converts it to
the week number?

Thanks in advance for any help!

Rusty


There is no need for an field in your table to store the week number.
As long as you have the date stored, you can always compute the week
number, in a query, form, or report.

=DatePart("ww",[DateField])

will return that dates week number, as will

=format([DateField],"ww")
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #3
FYI,

DatePart does not compute the ISO week number. For example, New Years day
was on a Saturday this year. DatePart("ww", #1/1/05#) would have returned 1.
On Monday, 1/3/05, DatePart("ww", #1/3/05#) would have returned 2. The ISO
week number for 1/1/05 to 1/4/05 is 1.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"MGFoster" <me@privacy.com> wrote in message
news:SG*****************@newsread1.news.pas.earthl ink.net...
RustyR wrote:
I have a DB where each record had a Date field. I know in Excel you can use the Weeknum() function to get the ISO week number for a given date.
Is there a way add a field in a Table that takes the date and converts it to the week number?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I don't know if it gives the ISO week number, but the DatePart()
function can return the week of the year:

DatePart("ww", Date())

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQkHnMIechKqOuFEgEQJEywCfUU2t3T7y9ClyQ4JOazlHMh G8SS4AoN/7
3eZa4p8Bsr0tn8jbGdY6xfHU
=tiTe
-----END PGP SIGNATURE-----

Nov 13 '05 #4
DatePart (and Format, for that matter) both accept two additional optional
parameters:

firstdayofweek, which specifies the first day of the week. (the default is
Sunday)
firstweekofyear, which specifies the first week of the year. (the default
is the first week is assumed to be the week in which January 1 occurs.)

Does tweaking them fix the problem?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"PC Datasheet" <no****@nospam.spam> wrote in message
news:lm***************@newsread2.news.atl.earthlin k.net...
FYI,

DatePart does not compute the ISO week number. For example, New Years day
was on a Saturday this year. DatePart("ww", #1/1/05#) would have returned
1.
On Monday, 1/3/05, DatePart("ww", #1/3/05#) would have returned 2. The ISO
week number for 1/1/05 to 1/4/05 is 1.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"MGFoster" <me@privacy.com> wrote in message
news:SG*****************@newsread1.news.pas.earthl ink.net...
RustyR wrote:
> I have a DB where each record had a Date field. I know in Excel you can use > the Weeknum() function to get the ISO week number for a given date.
> Is there a way add a field in a Table that takes the date and converts it to > the week number?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I don't know if it gives the ISO week number, but the DatePart()
function can return the week of the year:

DatePart("ww", Date())

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQkHnMIechKqOuFEgEQJEywCfUU2t3T7y9ClyQ4JOazlHMh G8SS4AoN/7
3eZa4p8Bsr0tn8jbGdY6xfHU
=tiTe
-----END PGP SIGNATURE-----


Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Vanessa | last post by:
Does anyone know whether when I select a weeknumber of a certain year, eg. 2004, the date from first day to the last day of the week will be known. Regards Vanessa
5
by: DD | last post by:
Hi there, I am working on a sql-query and I need to know the weeknumber of a given date. Could anyone please help me with this. Thanks in advance, Arjen
3
by: dik mus | last post by:
Hi, I connect to a database that only stores the year and weeknumber. But i need the date of the corresponding monday. This could be more difficult as one expect because the weekumbers might...
2
by: | last post by:
Hi!! know someone how to get a week span with week number and year? something like hi: public static DateTime GetWeekSpan(int weekNumber, int year) { DateTime weekStartDate = new...
10
by: bjaj | last post by:
Hi I have made this msgbox to display the current Week number, but it shows the wrong weekno. Can anyone tell me why ? msg = "WeekNumber: " & DatePart("WW", Date) MsgBox msg It shows...
4
by: khicon73 | last post by:
Hello All, I would like to calculate weeknumber and period from first day of the week (sunday) and last day of the week (saturday) and week number falls from 1 to 52 only. If week number >= 53 then...
4
by: Longkhi | last post by:
Hi Everybody. I'm developing a dentist program, which contains a MonthCalender. I would like to select a specific weeknumber, when I select a weeknumber in the MC. I can show the weeknumbers by...
1
by: peetersb | last post by:
Hi, I want ot make functions like this: int getFirtDayOfWeek(int weeknumber, int year); int getLastDayOfWeek(int weeknumber, int year); Firts I calculate the count of weeks like this: ...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.