Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > hard question on date


Reply
 
Thread Tools Display Modes
  #1  
Old 10-10-2001, 12:44 PM
Nemu Nemu is offline
Regular
 
Join Date: May 2001
Location: Montreal, Quebec, Canada
Posts: 85
Question hard question on date


Ok... this one is hard to explain... put simply I need to evaluate a date to see in which school year it is... A year begin on July 1st and ends on June 30th. I must take the end date of my classes and evaluate in which month it ends and if it's this year or last/next year. With the result I must look which month it ends and but a value in another form under the right month...
here's the basic code I have so far... I know it will be much more complex with the database and all...

Private Sub Command1_Click()
If Month(Text2.Text) > 6 Then
If Year(Text2.Text) = Year(Now()) Then
Text1.Text = "Happy New Year!!"
End If
Else
If Month(Text2.Text) < 7 Then
If Year(Text2.Text) = (Year(Now()) + 1) Then
Text1.Text = "The End is near!!"
End If
End If
End If
End Sub
__________________
There is no good and no bad, just perspective and opinion.
Reply With Quote
  #2  
Old 10-10-2001, 01:01 PM
jcd
Guest
 
Posts: n/a
Default Re: hard question on date

What do exactly want to do..does the code u have now not work...quickly looking at it...it seems to do what u want...maybe I am missing something.
regards
jcd
Reply With Quote
  #3  
Old 10-10-2001, 01:08 PM
Nemu Nemu is offline
Regular
 
Join Date: May 2001
Location: Montreal, Quebec, Canada
Posts: 85
Default Re: hard question on date

No... the code I post works fine but I need help ... now all I do is look at the date in the text2 and write a msg in the text1... but like I said in the previous post I must evaluate the date to see in which year it is and after that I must find the month depending of the year (always) and go put the result of a formula based on a class value in the right month...

If my class start today 01-10-10 and finish next year 02-10-10 then I must not count it... but if instead it finish on 02-05-30 then I would have to take it's value and go put it under the month of May in my other form...
__________________
There is no good and no bad, just perspective and opinion.
Reply With Quote
  #4  
Old 10-10-2001, 01:12 PM
jcd
Guest
 
Posts: n/a
Default Re: hard question on date

Couldnt you just do this....if(month = 5) then
[some object for displaying(may)].[correct property] = theClass...I think I am totally missing the point but I will try to understand
regards
jcd
Reply With Quote
  #5  
Old 10-10-2001, 02:40 PM
KesleyK's Avatar
KesleyK KesleyK is offline
Senior Contributor

Retired Moderator
* Expert *
 
Join Date: Jun 2001
Location: Idaho, missing Dallas
Posts: 965
Default Re: hard question on date

Well, I think your question has been answered, but let me give a shot. Given myDate, you want to know which class year:<pre>
If Month(myDate) &lt; 7 Then
SchoolYear = Year(myDate) - 1

Else
SchoolYear = Year(myDate)
End If
</pre>.
You can use the myDate to be the end of the class you're talking about to evaluate, since it doesn't sound like it matters when the class starts. If we are confused, please help us out.
__________________
We shall persevere.
Reply With Quote
  #6  
Old 10-11-2001, 06:31 AM
Nemu Nemu is offline
Regular
 
Join Date: May 2001
Location: Montreal, Quebec, Canada
Posts: 85
Default Re: hard question on date

It's a part of the solution... And it might help me a lot to find the rest of it....
The problem with your code is that if the group span over 3 or more year, then the evaluation of the date is wrong since the classes that were finished in the first year will calculate again... that's why I'm telling it's part of the solution...

But I must say thank you because the code you just wrote puts me in the right direction...

Back to the basic of programming... The Algorithms.... (is it how it's written??) That's the only way I will sort out what I must do to solve the problem completely....
__________________
There is no good and no bad, just perspective and opinion.
Reply With Quote
  #7  
Old 10-11-2001, 11:26 AM
KesleyK's Avatar
KesleyK KesleyK is offline
Senior Contributor

Retired Moderator
* Expert *
 
Join Date: Jun 2001
Location: Idaho, missing Dallas
Posts: 965
Default Re: hard question on date

Well, I am happy to have at least provided a tangent traveling from the arc of problems in a direction that is within SOME proximity of a solution!
__________________
We shall persevere.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->