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 / C++ / MFC
  4. Total days in a year !

Total days in a year !

Scheduled Pinned Locked Moved C / C++ / MFC
question
14 Posts 6 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.
  • L Le rner

    Hi all, PLease tell me how can i get Total days of a Year.(wheter 365 or 366) thanks in advance.

    IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH

    M Offline
    M Offline
    Michael Schubert
    wrote on last edited by
    #4

    You could use COleDateTime() or COleDateTimeSpan()

    1 Reply Last reply
    0
    • L Le rner

      Hi all, PLease tell me how can i get Total days of a Year.(wheter 365 or 366) thanks in advance.

      IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH

      S Offline
      S Offline
      SandipG
      wrote on last edited by
      #5

      Check this thread Leap Year[^]

      Regards, Sandip.

      M 1 Reply Last reply
      0
      • R Roger Stoltz

        If the year is a multiple of 4, it's a leap year, i.e. there are 366 days. Exception #1: If the year is dividable by 100 it's not a leap year. Exception #2: If the year is dividable by 400 it's a leap year anyway. Hint: use the modulus operator.

        "It's supposed to be hard, otherwise anybody could do it!" - selfquote
        "High speed never compensates for wrong direction!" - unknown

        P Offline
        P Offline
        PravinSingh
        wrote on last edited by
        #6

        Wow, I didn't know about exception #2, I always thought scientists decide after a few centuries whether this century year will be a leap year or not. :cool: Thanks.


        It's better to know some of the questions than all of the answers.
        Pravin.

        1 Reply Last reply
        0
        • S SandipG

          Check this thread Leap Year[^]

          Regards, Sandip.

          M Offline
          M Offline
          Michael Schubert
          wrote on last edited by
          #7

          bool isLeapYear(int year )
          {
          return year % 400 ? year % 100 ? year % 4 ? false : true : false : true;
          }

          There should be a forum for really cool code snippets like this! Nicely done Carlo!

          S R 2 Replies Last reply
          0
          • M Michael Schubert

            bool isLeapYear(int year )
            {
            return year % 400 ? year % 100 ? year % 4 ? false : true : false : true;
            }

            There should be a forum for really cool code snippets like this! Nicely done Carlo!

            S Offline
            S Offline
            SandipG
            wrote on last edited by
            #8

            Michael Schubert wrote:

            There should be a forum for really cool code snippets like this! Nicely done Carlo! Quote Selected Text

            No worries!! We have the magic site of carlo..:D

            Regards, Sandip.

            M 1 Reply Last reply
            0
            • S SandipG

              Michael Schubert wrote:

              There should be a forum for really cool code snippets like this! Nicely done Carlo! Quote Selected Text

              No worries!! We have the magic site of carlo..:D

              Regards, Sandip.

              M Offline
              M Offline
              Michael Schubert
              wrote on last edited by
              #9

              I'm serious!

              R S 2 Replies Last reply
              0
              • M Michael Schubert

                bool isLeapYear(int year )
                {
                return year % 400 ? year % 100 ? year % 4 ? false : true : false : true;
                }

                There should be a forum for really cool code snippets like this! Nicely done Carlo!

                R Offline
                R Offline
                Rajesh R Subramanian
                wrote on last edited by
                #10

                Michael Schubert wrote:

                There should be a forum for really cool code snippets like this!

                There is an entire website for this. Haven't you seen: http://www.cpallini.freeproductz.com[^] ;P

                Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

                M 1 Reply Last reply
                0
                • M Michael Schubert

                  I'm serious!

                  R Offline
                  R Offline
                  Rajesh R Subramanian
                  wrote on last edited by
                  #11

                  On a serious note, I completely agree with you. We need a "Cool Code" forum. :)

                  Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

                  1 Reply Last reply
                  0
                  • R Rajesh R Subramanian

                    Michael Schubert wrote:

                    There should be a forum for really cool code snippets like this!

                    There is an entire website for this. Haven't you seen: http://www.cpallini.freeproductz.com[^] ;P

                    Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

                    M Offline
                    M Offline
                    Michael Schubert
                    wrote on last edited by
                    #12

                    URLz iz givez me errorz. plz helpzz.. urgentzzzz!! wherez da codez???

                    1 Reply Last reply
                    0
                    • M Michael Schubert

                      I'm serious!

                      S Offline
                      S Offline
                      SandipG
                      wrote on last edited by
                      #13

                      Yes I agree with you May be you can add a suggestion in the suggestion forum..

                      Regards, Sandip.

                      M 1 Reply Last reply
                      0
                      • S SandipG

                        Yes I agree with you May be you can add a suggestion in the suggestion forum..

                        Regards, Sandip.

                        M Offline
                        M Offline
                        Michael Schubert
                        wrote on last edited by
                        #14

                        done.

                        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