Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

CWeek - A Class for Getting the weekday and weeknumber

0.00/5 (No votes)
22 Mar 2004 1  
Getting the weekday and weeknumber

Introduction

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. :-)

Background

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

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.

date.setDate(2004,10,15);

To retrieve the weekday or the weeknumber, simply use:

nWeeknumber = date.getWeeknumber();
nWeekday = date.getWeekday();

History

  • 23rd March, 2004: Initial version

License

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.

License

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