 |
 |

10-10-2001, 12:44 PM
|
|
Regular
|
|
Join Date: May 2001
Location: Montreal, Quebec, Canada
Posts: 85
|
|
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.
|

10-10-2001, 01:01 PM
|
|
|
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
|
|

10-10-2001, 01:08 PM
|
|
Regular
|
|
Join Date: May 2001
Location: Montreal, Quebec, Canada
Posts: 85
|
|
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.
|

10-10-2001, 01:12 PM
|
|
|
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
|
|

10-10-2001, 02:40 PM
|
 |
Senior Contributor
Retired Moderator * Expert *
|
|
Join Date: Jun 2001
Location: Idaho, missing Dallas
Posts: 965
|
|
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) < 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.
|

10-11-2001, 06:31 AM
|
|
Regular
|
|
Join Date: May 2001
Location: Montreal, Quebec, Canada
Posts: 85
|
|
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.
|

10-11-2001, 11:26 AM
|
 |
Senior Contributor
Retired Moderator * Expert *
|
|
Join Date: Jun 2001
Location: Idaho, missing Dallas
Posts: 965
|
|
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.
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
 |
|