Solved

DateTime Comparison

Posted on 2006-11-11
6
350 Views
Last Modified: 2010-04-23
I am trying to compare a date with another date.  Unfortunately, I am not being able to get a match even though they should.  The date is created with the Now() function placed in a database in a datetime field.  Then I get it from the database with myStructure.DateTime = CDate(record("ReminderDateTime")).  Below is output from the immediate window.  Any Ideas?

?st.DateTime.CompareTo(st2.DateTime)
-1

?st.DateTime
#11/11/2006 3:35:28 PM#

?st2.DateTime
#11/11/2006 3:35:28 PM#

?st.DateTime = st2.DateTime
False
0
Comment
Question by:kmcbrearty
  • 4
  • 2
6 Comments
 
LVL 29

Accepted Solution

by:
Nightman earned 500 total points
ID: 17922625
The values differ - probably only by a millisecond, but they differ. What do you get if you look at the millisecond value of these two? st1.Millisecond and st2.Millisecond?
0
 
LVL 29

Expert Comment

by:Nightman
ID: 17922632
Or even more granluar, st1.Ticks and st2.Ticks
0
 
LVL 3

Author Comment

by:kmcbrearty
ID: 17922804
I wasn't thinking about that.  I decided to use Now.ToString to assign the date.  I am not concerned with that much precision so it will work fine.
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 29

Expert Comment

by:Nightman
ID: 17924562
OK, I have to ask. Why the B Grade?
0
 
LVL 3

Author Comment

by:kmcbrearty
ID: 17925455
While you pointed me in the right direction you didn't actually solve the issue.
0
 
LVL 29

Expert Comment

by:Nightman
ID: 17925506
Strictly speaking, your question was why they differed, not how to force them to be equal, but don't worry about it - I can live with a B.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question