Total days in a year !
-
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
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 -
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 -
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
You could use
COleDateTime()
orCOleDateTimeSpan()
-
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
-
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!" - unknownWow, 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. -
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!
-
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!
-
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.
I'm serious!
-
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!
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++]
-
I'm serious!
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++]
-
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++]
URLz iz givez me errorz. plz helpzz.. urgentzzzz!! wherez da codez???
-
I'm serious!
-
Yes I agree with you May be you can add a suggestion in the suggestion forum..
Regards, Sandip.
done.