New topic: 

Select Case Date not working

<http://forums.realsoftware.com/viewtopic.php?t=32407>

       Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic         Author  
Message       rlinsurf           Post subject: Select Case Date not 
workingPosted: Mon Feb 08, 2010 7:38 pm                        
Joined: Tue Mar 21, 2006 12:49 am
Posts: 196              I have the following snippet:

Code:Dim v as Variant
Dim d as Date
d=New Date
v=d

orderDate.text = v

Dim dayNumber As Integer
Dim msg As String
dayNumber=Val(v)
Select Case dayNumber
Case 2
  msg="It's Monday"
Case 3
  msg="It's Tuesday"
Case 4
  msg="It's Wednesday"
Case 5
  msg="It's Thursday"
Case 6
  msg="It's Friday"
Else
  msg="It's the weekend."
End Select
MsgBox msg


Even though today is obviously Monday, I'm getting "It's the weekend" every 
time I run.   
                            Top               tomsi           Post subject: Re: 
Select Case Date not workingPosted: Mon Feb 08, 2010 7:49 pm                    
    
Joined: Wed Nov 16, 2005 4:58 pm
Posts: 65
Location: Sandvika, Norway              Try 

Code:dayNumber = d.DayOfWeek

Not sure what val(v) returns but I would not be suprised if you get the number 
of seconds since some time ages ago ...   
                            Top                rlinsurf           Post subject: 
Re: Select Case Date not workingPosted: Mon Feb 08, 2010 7:50 pm                
        
Joined: Tue Mar 21, 2006 12:49 am
Posts: 196              Heh. I just figured that out myself...

That was it of course    
                            Top           Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 3 posts ]     
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to