Options

Getting the week number of a date

Koen_RoggemanKoen_Roggeman Member Posts: 17
edited 2005-01-10 in Navision Financials
Hello is it possible in a simple way to find out the week number if a given date ?

thx

Comments

  • Options
    PEzechielsPEzechiels Member Posts: 83
    Try DATE2DWY(Date,2)

    that should work
  • Options
    GoMaDGoMaD Member Posts: 313
    having a problem with this one.

    Windows returns for 03 january 2005 weeknumber 2
    Navision returns for 03 january 2005 weeknumber 1

    :shock: :-s

    does anybody have a clue?
    Now, let's see what we can see.
    ...
    Everybody on-line.
    ...
    Looking good!
  • Options
    eromeineromein Member Posts: 589
    Wow!

    I'm digging in my memories.... I had something like this one time.... A long time ago.... lemme think, think.... THINK!!!!.... T!H!I!N!K!

    Nope... sorry... You got a real nice one here!
    "Real programmers don't comment their code.
    If it was hard to write, it should be hard to understand."
  • Options
    nelsonnelson Member Posts: 107
    edited 2005-01-05
    According to ISO 8601, 2005-January-03 really does belong to Week No. 1.

    It's possible that Windows is using ANSI for determining the Week Nos. what with Microsoft being based in the States and everything...
    Nelson Alberto
  • Options
    GoMaDGoMaD Member Posts: 313
    sadly enough the weeknumber functionality
    Number := DATE2DWY(TODAY, 2)
    
    returns 1 as week number for 03 january 2005

    But this is a system function and that means we cannot change anything about.

    Is it possible to redefine this in Windows?
    Now, let's see what we can see.
    ...
    Everybody on-line.
    ...
    Looking good!
  • Options
    nelsonnelson Member Posts: 107
    What I meant is that DATE2DWY function is returning the correct value.
    1 is the correct Week No. for 03 January 2005.

    Where in Windows did you get 2?
    Nelson Alberto
  • Options
    GoMaDGoMaD Member Posts: 313
    In Outlook and also i got it in a DLL.
    It has a function that returns the weeknumber.
    Now, let's see what we can see.
    ...
    Everybody on-line.
    ...
    Looking good!
  • Options
    Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    In Outlook 2003 you can define the first week of the year: Starts on Jan 1, First 4-day week, First full week
    You find this in Tools -> Options -> Calendar Options.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Options
    nelsonnelson Member Posts: 107
    I don't know about the DLL but Luc is right about Outlook (the only remark is the option already exists in XP and 2000, can't say anything about 97 and previous versions, though).
    Nelson Alberto
  • Options
    eromeineromein Member Posts: 589
    Is M$ going to hear about this?
    "Real programmers don't comment their code.
    If it was hard to write, it should be hard to understand."
  • Options
    tvandongentvandongen Member Posts: 78
    I think this is because a difference in calculating the weeknumber between Europe and US: In Europe the week with the first thursday on januari is week 1 (according to DIN1355 specification). In US the week of 1 january is week 1. :? :?
  • Options
    eromeineromein Member Posts: 589
    This could explain why my date didn't show up... We had a date on monday in week 12. Should have been week 13..... right....

    Lemme give her a call again... But actually... I don't think she will believe it!
    "Real programmers don't comment their code.
    If it was hard to write, it should be hard to understand."
Sign In or Register to comment.