Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. To get current week nr? is this wrong?

To get current week nr? is this wrong?

Scheduled Pinned Locked Moved Visual Basic
question
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Snowjim
    wrote on last edited by
    #1

    Hey! I have hear that the framework are not counting the weeks right? will this code work? Dim cal As New System.Globalization.GregorianCalendar Return cal.GetWeekOfYear(inDate, Globalization.CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday)

    S G 2 Replies Last reply
    0
    • S Snowjim

      Hey! I have hear that the framework are not counting the weeks right? will this code work? Dim cal As New System.Globalization.GregorianCalendar Return cal.GetWeekOfYear(inDate, Globalization.CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday)

      S Offline
      S Offline
      Snowjim
      wrote on last edited by
      #2

      If i set the year to 2007 and get the week nr from week 13(2007-03-26) to week 12(2008-03-17) then it counts the weeks wrong 2007-12-31 - 2008-01-06 is becoming week nr 53!? there is no week nr 53 in 2007. And thanks to this error the next week is missing(Week 1 2008(2008-01-07 - 2008-01-13))

      1 Reply Last reply
      0
      • S Snowjim

        Hey! I have hear that the framework are not counting the weeks right? will this code work? Dim cal As New System.Globalization.GregorianCalendar Return cal.GetWeekOfYear(inDate, Globalization.CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday)

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        Yes, the week number is wrong for certain dates when using the ISO standard calendar. I have created a method that can be used as a replacement. You can get it from my code archive[^]. --- b { font-weight: normal; }

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups