Click here to Skip to main content
15,908,776 members
Home / Discussions / C#
   

C#

 
QuestionRe: DateTime, DayOfWeek in range comparison Pin
Spacix One2-May-08 4:54
Spacix One2-May-08 4:54 
GeneralRe: DateTime, DayOfWeek in range comparison Pin
buchstaben2-May-08 5:19
buchstaben2-May-08 5:19 
AnswerRe: DateTime, DayOfWeek in range comparison [modified] Pin
#realJSOP2-May-08 6:35
professional#realJSOP2-May-08 6:35 
GeneralRe: DateTime, DayOfWeek in range comparison Pin
PIEBALDconsult2-May-08 7:39
mvePIEBALDconsult2-May-08 7:39 
GeneralRe: DateTime, DayOfWeek in range comparison Pin
#realJSOP2-May-08 7:45
professional#realJSOP2-May-08 7:45 
GeneralRe: DateTime, DayOfWeek in range comparison Pin
#realJSOP2-May-08 8:15
professional#realJSOP2-May-08 8:15 
GeneralRe: DateTime, DayOfWeek in range comparison Pin
PIEBALDconsult2-May-08 8:46
mvePIEBALDconsult2-May-08 8:46 
AnswerRe: DateTime, DayOfWeek in range comparison Pin
PIEBALDconsult2-May-08 7:28
mvePIEBALDconsult2-May-08 7:28 
return ( true ) ;

Every timepoint falls between some DayOfWeek X and some DayOfWeek Y. Big Grin | :-D


buchstaben wrote:
Thursday-Wednesday


Did you mean that?


If you want Sunday to sort higher than Saturday, then you can simply add seven to it, but you'll need to store the values as integers rather than as the provided enum values.

int x = (int) timepoint.DayOfWeek ;
int y = (int) from ;
int z = (int) to ;

x += x==0 ? 7 : 0 ;
y += y==0 ? 7 : 0 ;
z += z==0 ? 7 : 0 ;

return ( x >= y && x <= z ) ;


but that's rather ugly.
GeneralRe: DateTime, DayOfWeek in range comparison Pin
#realJSOP2-May-08 7:43
professional#realJSOP2-May-08 7:43 
AnswerRe: DateTime, DayOfWeek in range comparison Pin
#realJSOP2-May-08 8:10
professional#realJSOP2-May-08 8:10 
GeneralRe: DateTime, DayOfWeek in range comparison Pin
PIEBALDconsult2-May-08 9:13
mvePIEBALDconsult2-May-08 9:13 
GeneralRe: DateTime, DayOfWeek in range comparison Pin
PIEBALDconsult2-May-08 18:55
mvePIEBALDconsult2-May-08 18:55 
GeneralRe: DateTime, DayOfWeek in range comparison Pin
#realJSOP3-May-08 0:26
professional#realJSOP3-May-08 0:26 
GeneralRe: DateTime, DayOfWeek in range comparison Pin
PIEBALDconsult3-May-08 5:09
mvePIEBALDconsult3-May-08 5:09 
GeneralRe: DateTime, DayOfWeek in range comparison Pin
#realJSOP4-May-08 4:02
professional#realJSOP4-May-08 4:02 
GeneralRe: DateTime, DayOfWeek in range comparison Pin
PIEBALDconsult4-May-08 5:34
mvePIEBALDconsult4-May-08 5:34 
QuestionKeypress event Pin
D i x y2-May-08 2:38
D i x y2-May-08 2:38 
AnswerRe: Keypress event Pin
John Ad2-May-08 3:54
John Ad2-May-08 3:54 
AnswerRe: Keypress event Pin
PIEBALDconsult2-May-08 8:22
mvePIEBALDconsult2-May-08 8:22 
GeneralRe: Keypress event Pin
Adeel Chaudhry2-May-08 11:19
Adeel Chaudhry2-May-08 11:19 
GeneralRe: Keypress event Pin
PIEBALDconsult2-May-08 15:26
mvePIEBALDconsult2-May-08 15:26 
GeneralRe: Keypress event Pin
Adeel Chaudhry3-May-08 0:24
Adeel Chaudhry3-May-08 0:24 
QuestionExport Issue Pin
MumbleB2-May-08 2:30
MumbleB2-May-08 2:30 
AnswerRe: Export Issue Pin
Judah Gabriel Himango2-May-08 5:37
sponsorJudah Gabriel Himango2-May-08 5:37 
GeneralRe: Export Issue Pin
MumbleB2-May-08 5:45
MumbleB2-May-08 5:45 

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.