Thread: Simple Calendar question for find day of the week.

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    2

    Simple Calendar question for find day of the week.

    Suppose I have a calendar program to where someone enters a month and a year. How would I find out, what the start of the day is?

    Example: I enter 2 for month and 2003 for years. Thus, the first day of the month would return '7' (Sat).

    How would I write a function for this?

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    goto this sites source code section. There is a calender program in there somewhere. It illustrates Zeller's algorithm. This algorithm can produce the day of the week for any given date in the gregorian calender.There is also plenty of info online on zellers algo.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    2
    This one:
    http://www.cprogramming.com/source/c...ion=Jump&LID=2
    ?

    Well, it just ask you for the year and it will output the whole calendar. I wanted one when there's a functon that passes two paremeters (int month, int year) and it will return a number (1-7) depending on the first day of the week.

  4. #4
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    nope.

    this one.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Writing a program to make a calendar
    By Northstar in forum C Programming
    Replies: 17
    Last Post: 11-07-2007, 11:34 AM
  2. day of week
    By s_ny33 in forum C Programming
    Replies: 18
    Last Post: 11-02-2005, 11:56 AM
  3. The day of the week America was discovered
    By Gustaff in forum C Programming
    Replies: 3
    Last Post: 08-12-2005, 09:47 AM
  4. Simple question about pausing program
    By Noid in forum C Programming
    Replies: 14
    Last Post: 04-02-2005, 09:46 AM
  5. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM