Also, the line

dim d, theDate as new date

is dangerous.  Depending on the version of RB you're running, you could wind
up with two date pointers pointing to the same object.  In that case, when
you change one, the other would reflect the same change.  It's much safer to
code it as

dim d, theDate as date
d= new date
theDate= new date

Tim


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Fargo
> Holiday
> Sent: Saturday, October 28, 2006 10:46 PM
> To: REALbasic NUG
> Subject: Re: More date weirdness
>
>
> You should examine theDate.totalseconds+i+j+s in your second message
> box, since that's what you're comparing against.You'll find that changes
> your perception.
> Like this: MsgBox "Nope." + Format(d.totalseconds, "##########")+
> EndOfLine +Format((theDate.totalseconds+i+j+s), "##########")
>
> Jeffrey Ellis wrote:
> > So. I have a fairly simply little calculation which is failing.
> >
> > I'm trying to compare a user-entered date and time to the
> current date and
> > time.
> >
> > Here's the code:
> >
> >   Dim d, theDate as new date
> >   dim h, m, s, i, j as integer
> >   dim edate, formatTotalSeconds as string
> >   Dim t as Boolean
> >
> >
> >   edate=EnterDate.text//the EnterDate editfield
> >   h=val(hour.text)//the hour editfield
> >   i=h*60*60
> >   m=val(min.text)//the minute editfield
> >   j=m*60
> >   s=val(sec.text)//the second editfield
> >
> >   t=ParseDate(edate,theDate)
> >
> >   theDate.hour=h
> >   theDate.Minute=m
> >   theDate.second=s
> >
> >   If d.totalseconds>=(theDate.totalseconds+i+j+s) Then
> >     beep
> >     MsgBox Format(d.totalseconds, "#######################")+"
> > "+Format(theDate.totalseconds, "#######################")
> >   else
> >     MsgBox"Nope. Format(d.totalseconds, "##########")+"
> > "+Format(theDate.totalseconds, "##########")
> >   End If
> >
> > My Result at 10:20:40pm on 10/28/06, with the User fields being set to
> > 10/28/06 22 20 00 respectively was:
> >
> > d.totalseconds=3244918841
> > theDate.totalseconds=3244918800
> >
> > Now clearly, 3244918841 is > than 3244918800
> >
> > And yet, I get the second msgBox!
> >
> > Can someone please enlighten me?
> >
> > All My Best,
> > Jeffrey
> >
> >
> > _______________________________________________
> > Unsubscribe or switch delivery mode:
> > <http://www.realsoftware.com/support/listmanager/>
> >
> > Search the archives of this list here:
> > <http://support.realsoftware.com/listarchives/lists.html>
> >
> >
> >
> >
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives of this list here:
> <http://support.realsoftware.com/listarchives/lists.html>
>
>


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to