Click here to Skip to main content
15,909,051 members
Home / Discussions / C#
   

C#

 
GeneralRe: date [modified] Pin
Luc Pattyn22-Jan-10 3:06
sitebuilderLuc Pattyn22-Jan-10 3:06 
Huh?

Where I live, there are four quarters in a year (as in most everything else), so each quarter holds three months. That means the divisor has to be three, not four.

Month         1  2  3  4  5  6  7  8  9 10 11 12
(Month+2)/3   1  1  1  2  2  2  3  3  3  4  4  4
(Month/4)+1   1  1  1  2  2  2  2  3  3  3  3  4
                                !        !  ! 


[ADDED]
((Month-1)/3)+1 would be fine too, however I always prefer the other form, as it looks better (for me at least), and it is somewhat safer, with an outer operator of higher precedence so you can subtract it from something without needing extra parentheses; that is somewhat similar to inverse order tests such as if (null==variable)..., which I don't use!
[/ADDED]

Smile | :)

Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
[The QA section does it automatically now, I hope we soon get it on regular forums as well]


modified on Friday, January 22, 2010 12:49 PM

GeneralRe: date Pin
#realJSOP22-Jan-10 3:14
professional#realJSOP22-Jan-10 3:14 
GeneralRe: date Pin
Luc Pattyn22-Jan-10 3:19
sitebuilderLuc Pattyn22-Jan-10 3:19 
GeneralRe: date Pin
OriginalGriff22-Jan-10 3:56
mveOriginalGriff22-Jan-10 3:56 
GeneralRe: date Pin
Luc Pattyn22-Jan-10 6:39
sitebuilderLuc Pattyn22-Jan-10 6:39 
AnswerRe: date Pin
Jimmanuel22-Jan-10 1:48
Jimmanuel22-Jan-10 1:48 
QuestionSmart Client Software Factory (SCSF) Pin
Sujit Mandal21-Jan-10 22:19
Sujit Mandal21-Jan-10 22:19 
AnswerRe: Smart Client Software Factory (SCSF) Pin
thatraja22-Jan-10 2:28
professionalthatraja22-Jan-10 2:28 
Questionparse a sentence [modified] Pin
farokhian21-Jan-10 21:08
farokhian21-Jan-10 21:08 
AnswerRe: parse a sentence Pin
OriginalGriff21-Jan-10 21:45
mveOriginalGriff21-Jan-10 21:45 
GeneralRe: parse a sentence [modified] Pin
farokhian21-Jan-10 22:24
farokhian21-Jan-10 22:24 
GeneralRe: parse a sentence Pin
OriginalGriff21-Jan-10 23:08
mveOriginalGriff21-Jan-10 23:08 
QuestionHow to make a Walking man in directx using C# Pin
Maninandan21-Jan-10 21:02
Maninandan21-Jan-10 21:02 
AnswerRe: How to make a Walking man in directx using C# Pin
Member 103390722-Jan-10 5:13
Member 103390722-Jan-10 5:13 
QuestionStuck trying to learn to do SubmitChanges Pin
Nigel Mackay21-Jan-10 19:33
Nigel Mackay21-Jan-10 19:33 
AnswerRe: Stuck trying to learn to do SubmitChanges Pin
Som Shekhar21-Jan-10 19:48
Som Shekhar21-Jan-10 19:48 
GeneralRe: Stuck trying to learn to do SubmitChanges Pin
Nigel Mackay21-Jan-10 20:26
Nigel Mackay21-Jan-10 20:26 
AnswerRe: Stuck trying to learn to do SubmitChanges Pin
Nigel Mackay21-Jan-10 20:49
Nigel Mackay21-Jan-10 20:49 
GeneralRe: Stuck trying to learn to do SubmitChanges Pin
Som Shekhar21-Jan-10 22:24
Som Shekhar21-Jan-10 22:24 
GeneralRe: Stuck trying to learn to do SubmitChanges Pin
Nigel Mackay21-Jan-10 23:23
Nigel Mackay21-Jan-10 23:23 
GeneralRe: Stuck trying to learn to do SubmitChanges Pin
Som Shekhar21-Jan-10 23:39
Som Shekhar21-Jan-10 23:39 
GeneralRe: Stuck trying to learn to do SubmitChanges Pin
Nigel Mackay22-Jan-10 0:12
Nigel Mackay22-Jan-10 0:12 
Questionproblem with assigning a strong name to an assembly Pin
prasadbuddhika21-Jan-10 18:29
prasadbuddhika21-Jan-10 18:29 
AnswerRe: problem with assigning a strong name to an assembly Pin
prasadbuddhika21-Jan-10 22:07
prasadbuddhika21-Jan-10 22:07 
QuestionProblem getting shared folder that created by code using Win32_LogicalShareSecuritySetting [modified] Pin
cyn821-Jan-10 16:49
cyn821-Jan-10 16:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.