Seems a good solution if wanting a string. Would go with strftime rather than COleDateTime, unless the necessary dlls, etc, are already loaded and initialised. However, I note it does not deal with many of the edge cases - namely first and last weeks of the year, returning 0 and 53 in many cases where it should return 52 or 53 and 1 respectively. This is a good solution, provided that you are happy with the way the week number is calculated: being based on Monday as the first day of the week and the first week of the year being the first one which starts on Monday, and the return value being a string. Note that this means you will have week of year values from 0 to 53. And you can't simply add one to the week, since when the year starts on Monday it will already be week one, so you'd make it week two. Thus all the solutions given so far, while some of them including my own will give a week number based on 1st Jan, they will not calculate the week of the year used as standard. Also, it seems weeks do officially run from Monday to Sunday even though we all know that Sunday is the first day of the week! This says that week one of any year starts on the Monday before the first Thursday of the year. Or in other words, week one is the week in which the 4th of January falls Monday to Sunday. The initial calculation is similar to my first solution, but instead of adding 7, add 10 and we have to adjust wday to 7 if it is 0 for Sunday. Then if this calculation returns 0 the day is part of the last week of the preceding year. If it returns 53 we have to determine if it is part of week 1 of the next year, or if the year really does have 53 weeks there are 71 in every 400 years - 5, 6 or 7 years apart. Are you sure this is necessary? I have not tested out Solution 1 to verify it always works correctly, but I would think that it does, including taking the locale into account. Things like which is the first day of the week is a locale setting and changes how the Windows calendar controls are laid out. Soren Madsen Well, I ran a few dates from beginning of Jan and End of Dec through it for years between 1997 and 2015. Try it yourself and see what you get. Sometimes when it returns 52 or 53 it should be week 1 of the next year. So it looks like it would still need some adjustment, though it is less clear what. But anyway, I've enjoyed looking into this tonight - didn't realise such a simple question could have so many controversies have you looked at the Wikipedia discussion page? The basic calculation week from beginning of the year is straight forward. I realise fitting in with Windows' locale options is important : If you find a function that does it correctly, or some setting perhaps that sorts strftime out, by all means share it. Actually sadly gripped by this aren't I! So it would appear it doesn't take the locale into account. I can also see now that it takes the first week of the year being from the first Monday in the year. Yes, I saw the definition for %W said Monday as first day of week, but that matches your ISO definition in the Wiki link. This actually explains to me why hardly any Americans know about week numbers at all, while back in Denmark where Monday is the first day of the week they are printed on just about every single calendar. I remember back in 1998, the calendars we had at the office in Denmark had messed things up and showed the last two weeks as 52, 52 instead of 52, 53. It was pretty funny. The strftime function, as you point out, also doesn't adjust the partial weeks at the start and end. Note that although it's not been marked as the answer, this solution I've provided is the ONLY one given so far which does give the standard week numbers. Who'd have thought such a simple question could have so many possibilities? Even if you'd specified the same year in your calculation, this answer as well as the other one doesn't take into account which day is the first day of the year - so a week here may be defined as Monday to Sunday one year, Tuesday to Monday another year, Wednesday to Tuesday another year, etc, etc. Yes, I think that actually introduces an error. So there are now two weeks that are week 1. Once you've called mktime, the tm structure you passed will have been completed to contain the day of year and the week day, so you only need to call it once for the date you are interested in and then calculate based on that. See my solution : Regards, Ian. Wed 1 Jan to Tues 7th Jan is week 1; Wed 8th Jan to Tues 14th Jan is week 2; etc. Anyway Ian A Davidson , my answer is correct, but unfortunately you're just don't understand it well enough. In addition, I believe that my answer in general is more understandable for users Regards, Alex. Sorry if I am misunderstanding you. The solution you have proposed assumes each week number is based on the day on which the YEAR starts. The standard answer in this case, however, should be week 3! Week 1 is: Wed 1st-Sun 5th; Week 2: Mon 6th-Sun 12th; Week 3: Mon 13th-Sun 19th. OR, if starting on Sunday: Wed 1st-Sat 4th; Sun 5th-Sat 11th; Sun 12th-Sat 18th. I hope this helps. Insults are not welcome. Chances are they have and don't get it. Provide an answer or move on to the next question. Let's work to help developers, not make them feel stupid.