|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
What is the correct format for DateTime.Compare ?Hi;
What is the correct format for the method DateTime.Compare ? I can't get this to work - Dim currDteTime as DateTime = #08/15/2006 02:45:00 PM# If DateTime.Compare(DateTime.Now, currDteTime) = 0 then myNextSub() End If What am I doing wrong ? Thanks, -- Gordon Gordon,
Is it because of the zero before the 8. Instead of #08/15/2006 02:45:00 PM#, try #8/15/2006 02:45:00 PM#. Not sure but I had a problem with that before. Scott Gordon wrote: Show quoteHide quote > Hi; > > What is the correct format for the method DateTime.Compare ? > > I can't get this to work - > > Dim currDteTime as DateTime = #08/15/2006 02:45:00 PM# > > If DateTime.Compare(DateTime.Now, currDteTime) = 0 then > myNextSub() > End If > > What am I doing wrong ? > > Thanks, > -- > Gordon Gordon,
Is it because of the zero before the 8. Instead of #08/15/2006 02:45:00 PM#, try #8/15/2006 02:45:00 PM#. Not sure but I had a problem with that before. Scott Gordon wrote: Show quoteHide quote > Hi; > > What is the correct format for the method DateTime.Compare ? > > I can't get this to work - > > Dim currDteTime as DateTime = #08/15/2006 02:45:00 PM# > > If DateTime.Compare(DateTime.Now, currDteTime) = 0 then > myNextSub() > End If > > What am I doing wrong ? > > Thanks, > -- > Gordon How are you going to guarantee that DateTime.Now and your curDteTime will
ever be equal? Show quoteHide quote "Gordon" <Gor***@discussions.microsoft.com> wrote in message news:EB5E85D5-12DE-4455-B6FC-977DE817A445@microsoft.com... > Hi; > > What is the correct format for the method DateTime.Compare ? > > I can't get this to work - > > Dim currDteTime as DateTime = #08/15/2006 02:45:00 PM# > > If DateTime.Compare(DateTime.Now, currDteTime) = 0 then > myNextSub() > End If > > What am I doing wrong ? > > Thanks, > -- > Gordon The datetime.compare is done within a loop. And curDteTime will occur in the
future -- Show quoteHide quoteGordon "Mudhead" wrote: > How are you going to guarantee that DateTime.Now and your curDteTime will > ever be equal? > > > "Gordon" <Gor***@discussions.microsoft.com> wrote in message > news:EB5E85D5-12DE-4455-B6FC-977DE817A445@microsoft.com... > > Hi; > > > > What is the correct format for the method DateTime.Compare ? > > > > I can't get this to work - > > > > Dim currDteTime as DateTime = #08/15/2006 02:45:00 PM# > > > > If DateTime.Compare(DateTime.Now, currDteTime) = 0 then > > myNextSub() > > End If > > > > What am I doing wrong ? > > > > Thanks, > > -- > > Gordon > > > I think you should read the Polling For Time article here:
http://www.flounder.com/badprogram.htm#SleepEx. Show quoteHide quote "Gordon" <Gor***@discussions.microsoft.com> wrote in message news:05216D44-4B69-4742-8C90-819880720D52@microsoft.com... > The datetime.compare is done within a loop. And curDteTime will occur in > the > future > -- > Gordon > > > "Mudhead" wrote: > >> How are you going to guarantee that DateTime.Now and your curDteTime will >> ever be equal? >> >> >> "Gordon" <Gor***@discussions.microsoft.com> wrote in message >> news:EB5E85D5-12DE-4455-B6FC-977DE817A445@microsoft.com... >> > Hi; >> > >> > What is the correct format for the method DateTime.Compare ? >> > >> > I can't get this to work - >> > >> > Dim currDteTime as DateTime = #08/15/2006 02:45:00 PM# >> > >> > If DateTime.Compare(DateTime.Now, currDteTime) = 0 then >> > myNextSub() >> > End If >> > >> > What am I doing wrong ? >> > >> > Thanks, >> > -- >> > Gordon >> >> >> Mudhead wrote:
> I think you should read the Polling For Time article here: Great page!> http://www.flounder.com/badprogram.htm#SleepEx. -- Larry Lard larryl***@googlemail.com The address is real, but unread - please reply to the group For VB and C# questions - tell us which version do a parse instead....
dim currDteTime as DateTime = DateTime.Parse("8/15/2006 2:45:00 PM") its more .NET like then the old VB ## method Show quoteHide quote "Gordon" <Gor***@discussions.microsoft.com> wrote in message news:EB5E85D5-12DE-4455-B6FC-977DE817A445@microsoft.com... > Hi; > > What is the correct format for the method DateTime.Compare ? > > I can't get this to work - > > Dim currDteTime as DateTime = #08/15/2006 02:45:00 PM# > > If DateTime.Compare(DateTime.Now, currDteTime) = 0 then > myNextSub() > End If > > What am I doing wrong ? > > Thanks, > -- > Gordon Smokey,
> On what is that statement based?> dim currDteTime as DateTime = DateTime.Parse("8/15/2006 2:45:00 PM") > > its more .NET like then the old VB ## method > dim currDteTime as DateTime = new DateTime(2006, 8, 14,45,00) Is in my idea more correct and also in standard ISO globalized format . The by you used format is only good in the USA and Coca Cola cultures, not even in English speaking Canada. Cor | What am I doing wrong ? You only gave hours & minutes on your time, datetime.now also includes seconds, milliseconds & fractions of milliseconds: currDteTime: 8/15/2006 2:45:00 PM DateTime.Now: 8/15/2006 5:53:57 PM Generally its safer to compare times either less or greater; something like: | If DateTime.Compare(DateTime.Now, currDteTime) <= 0 then | myNextSub() | End If -- Show quoteHide quoteHope this helps Jay B. Harlow [MVP - Outlook] ..NET Application Architect, Enthusiast, & Evangelist T.S. Bradley - http://www.tsbradley.net "Gordon" <Gor***@discussions.microsoft.com> wrote in message news:EB5E85D5-12DE-4455-B6FC-977DE817A445@microsoft.com... | Hi; | | What is the correct format for the method DateTime.Compare ? | | I can't get this to work - | | Dim currDteTime as DateTime = #08/15/2006 02:45:00 PM# | | If DateTime.Compare(DateTime.Now, currDteTime) = 0 then | myNextSub() | End If | | What am I doing wrong ? | | Thanks, | -- | Gordon Gordon,
In addition to Jay, Decide what datepart you want to compare. The current as you have used has in my idea a low hit change because the datetime structure retuns dates which are a kind of secure in 100th of a nanosecond. I would probably do it with an ANDALSO with the date and TimeOfDay member from DateTime. http://msdn2.microsoft.com/en-us/library/system.datetime_members.aspx I hope this helps, Cor Show quoteHide quote "Gordon" <Gor***@discussions.microsoft.com> schreef in bericht news:EB5E85D5-12DE-4455-B6FC-977DE817A445@microsoft.com... > Hi; > > What is the correct format for the method DateTime.Compare ? > > I can't get this to work - > > Dim currDteTime as DateTime = #08/15/2006 02:45:00 PM# > > If DateTime.Compare(DateTime.Now, currDteTime) = 0 then > myNextSub() > End If > > What am I doing wrong ? > > Thanks, > -- > Gordon
Update DataSet
Using OLEDB with Excel IndexOf string method VB.Net Appliction stops working when version is updated CurrentUser Using values from one useform in another userform Difficult Task vb 2005 express > querry table in access and put contents into array How to read large text file ? brain death |
|||||||||||||||||||||||