Thread: ISO week number

  1. #1
    Registered User
    Join Date
    Oct 2011
    Location
    Montreal Canada
    Posts
    6

    ISO week number

    There is a closed thread about week number which does not provide the ISO or manufacturing week number. I would like to reopen the thread

    The week number has January 4th somewhere between Monday
    and Sunday.
    Week one consists of part of last year where January 1 of the year is before the Thursday in the new year.

    Example 1
    SU MO TU WE TH FR SA SU
    29 30 31 1 2 3 4 5 This is week 1 because JAN 4 is before SU

    Example 2
    SU MO TU WE TH FR SA SU
    27 28 29 30 31 1 2 3 This could be week 52 or 53 depending
    on the starting year and leap year.

    I believe that the main function is one which for a date provides the week day number.
    It is not to difficult to calculate the starting week 1,
    but then you need to also check the cutoff for the last week in the year. Wikipaedia and ISO week number provides some good explanations, but no c or c++ code.
    Last edited by lsatenstein; 12-27-2012 at 08:31 PM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    An actual link to the closed thread would be useful.

    strftime
    Does your implementation support the %V format?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. week number definition for Linux ?
    By learn in forum Linux Programming
    Replies: 4
    Last Post: 08-28-2011, 11:13 AM
  2. hey all for the second time this week
    By xixpsychoxix in forum C++ Programming
    Replies: 6
    Last Post: 05-31-2007, 02:14 PM
  3. day of week
    By s_ny33 in forum C Programming
    Replies: 18
    Last Post: 11-02-2005, 11:56 AM
  4. e-week, networking, and a 96 hour week...
    By doubleanti in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 02-23-2003, 05:23 PM

Tags for this Thread