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
  1. Home
  2. General Programming
  3. C#
  4. days of week

days of week

Scheduled Pinned Locked Moved C#
csharpasp-nethelp
8 Posts 3 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.
  • M Offline
    M Offline
    mnaveed
    wrote on last edited by
    #1

    hi wot is the best way to get the days of current week or any week in year when developing C# and asp.net application. i m using the calendar control. thank you for your help. do it man

    M 1 Reply Last reply
    0
    • M mnaveed

      hi wot is the best way to get the days of current week or any week in year when developing C# and asp.net application. i m using the calendar control. thank you for your help. do it man

      M Offline
      M Offline
      Mazdak
      wrote on last edited by
      #2

      DateTime.DayOfWeek property. Mazy No sig. available now.

      M 1 Reply Last reply
      0
      • M Mazdak

        DateTime.DayOfWeek property. Mazy No sig. available now.

        M Offline
        M Offline
        mnaveed
        wrote on last edited by
        #3

        how can we get the seven days a whole week of particular date.not a particular day of week. thank you do it man

        M H 2 Replies Last reply
        0
        • M mnaveed

          how can we get the seven days a whole week of particular date.not a particular day of week. thank you do it man

          M Offline
          M Offline
          Mazdak
          wrote on last edited by
          #4

          I can't understand you,could you give an example about what you want? Mazy No sig. available now.

          1 Reply Last reply
          0
          • M mnaveed

            how can we get the seven days a whole week of particular date.not a particular day of week. thank you do it man

            H Offline
            H Offline
            Heath Stewart
            wrote on last edited by
            #5

            Get the CultureInfo for the language/culture for which you want the names and use the DateTimeFormat property:

            CultureInfo culture = Thread.CurrentCulture;
            string[] days = culture.DateTimeFormat.DayNames;

            -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

            M 1 Reply Last reply
            0
            • H Heath Stewart

              Get the CultureInfo for the language/culture for which you want the names and use the DateTimeFormat property:

              CultureInfo culture = Thread.CurrentCulture;
              string[] days = culture.DateTimeFormat.DayNames;

              -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

              M Offline
              M Offline
              mnaveed
              wrote on last edited by
              #6

              i want to get the 7 dates of week. like if today is the 6 jan in calendar control 2nd day of current week. i want to get all the 7 dates from monday to sunday from(5-01-04 to 11-01-04)how can i get thoes dates from calender control.did u get my point or not. thank you. do it man

              H 1 Reply Last reply
              0
              • M mnaveed

                i want to get the 7 dates of week. like if today is the 6 jan in calendar control 2nd day of current week. i want to get all the 7 dates from monday to sunday from(5-01-04 to 11-01-04)how can i get thoes dates from calender control.did u get my point or not. thank you. do it man

                H Offline
                H Offline
                Heath Stewart
                wrote on last edited by
                #7

                First of all, Tuesday, January 6th, 2004 is not the 2nd day of the week in the en-US culture - nor in many other cultures - it is the 3rd. This all comes down to culture-specific information. Use the following to get what the day of week is for the specific culture:

                CultureInfo culture = Thread.CurrentCulture;
                int dayOfWeek = (int)culture.Calendar.GetDayOfWeek(DateTime.Now);

                An enum like DayOfWeek can be cast to an int. In this case, the DayOfWeek members correspond to the number for the week, i.e. Sunday = 0, Monday = 1, Tuesday = 2, etc. You should add 1 to this value since most people think in base 1, not base 0.

                -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

                M 1 Reply Last reply
                0
                • H Heath Stewart

                  First of all, Tuesday, January 6th, 2004 is not the 2nd day of the week in the en-US culture - nor in many other cultures - it is the 3rd. This all comes down to culture-specific information. Use the following to get what the day of week is for the specific culture:

                  CultureInfo culture = Thread.CurrentCulture;
                  int dayOfWeek = (int)culture.Calendar.GetDayOfWeek(DateTime.Now);

                  An enum like DayOfWeek can be cast to an int. In this case, the DayOfWeek members correspond to the number for the week, i.e. Sunday = 0, Monday = 1, Tuesday = 2, etc. You should add 1 to this value since most people think in base 1, not base 0.

                  -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

                  M Offline
                  M Offline
                  mnaveed
                  wrote on last edited by
                  #8

                  Thank you very much for your help:rose: could u give me some help that how can i create a Year View calendar in ASP.net in which i can show the user all the 12 month of a year and can navigate through diff years. Thank you once again for your help. do it man

                  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