Click here to Skip to main content
11,930,231 members (38,022 online)
Click here to Skip to main content
Add your own
alternative version


15 bookmarked

CWeek - A class for getting the weekday and weeknumber

, 22 Mar 2004
Rate this:
Please Sign up or sign in to vote.
Getting the weekday and weeknumber.


This is my first attempt ever to write an article of any kind. I don't have much experience in programming, but I would love some feedback about this article in order to learn. English is not my primary language so be nice to me. Smile | :)


I'm currently working on a calender application with a friend of mine, and knowing the weekday and the weeknumber is somehow fundamental. Wink | ;)

I can't remember where I found the algorithms and information necessary to know how to retrieve the weekday and weeknumber, but if you know, then contact me and I will give the person credits for it.

How to use CWeek

CWeek is easy to use. First, declare an instance of the object.
CWeek date;
After this you should set the date. For example October 15, 2004.
To retrieve the weekday or the weeknumber, simply use:
nWeeknumber = date.getWeeknumber();
nWeekday = date.getWeekday();


  • 23 March 2004
    • Initial version.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Patrik Svensson
Software Developer
Sweden Sweden
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralWhich week number Pin
Willzyba22-Nov-04 5:12
memberWillzyba22-Nov-04 5:12 
GeneralSome Comments Pin
Johann Gerell25-Mar-04 12:37
memberJohann Gerell25-Mar-04 12:37 
GeneralRe: Some Comments Pin
Patrik Svensson26-Mar-04 5:54
memberPatrik Svensson26-Mar-04 5:54 
GeneralWhy not base this class on CDateTime Pin
Gerard Nicol23-Mar-04 14:47
memberGerard Nicol23-Mar-04 14:47 
GeneralRe: Why not base this class on CDateTime Pin
Gerard Nicol23-Mar-04 14:55
memberGerard Nicol23-Mar-04 14:55 
GeneralRe: Why not base this class on CDateTime Pin
Eric Lapouge23-Mar-04 21:37
memberEric Lapouge23-Mar-04 21:37 
GeneralRe: Why not base this class on CDateTime Pin
Johann Gerell25-Mar-04 12:39
memberJohann Gerell25-Mar-04 12:39 
GeneralMisc comments Pin
Eric Lapouge23-Mar-04 6:50
memberEric Lapouge23-Mar-04 6:50 
GeneralRe: Misc comments Pin
Patrik Svensson23-Mar-04 7:00
memberPatrik Svensson23-Mar-04 7:00 
GeneralRe: Misc comments Pin
Eric Lapouge23-Mar-04 7:26
memberEric Lapouge23-Mar-04 7:26 
GeneralKISS - Keep it simply stated Pin
NGS 54967223-Mar-04 6:36
memberNGS 54967223-Mar-04 6:36 
GeneralRe: KISS - Keep it simply stated Pin
Patrik Svensson23-Mar-04 7:08
memberPatrik Svensson23-Mar-04 7:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.151126.1 | Last Updated 23 Mar 2004
Article Copyright 2004 by Patrik Svensson
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid