Solved

decode date problems in d3

Posted on 1998-04-08
5
254 Views
Last Modified: 2010-04-06
I do a decodedate(myDate) where myDate = 27 minutes (0.0188) and it returns y = 1899, m = 12, d = 30. These seemt o be the defaults now instead of zero - try setting a TDateTime paradoz field to zero, these are the value stored, whereas before they were zero. This is causing code that worked in d1 to blow as previously these values were all 0. How can I get around this? Thanks, Tom.
0
Comment
Question by:tomcorcoran
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
inter earned 100 total points
ID: 1361354
Hi friend,

The TDatetime is incompatible between D1 and D2+. Here is how to convert one another:
(Taken from the Delphi 2.0 help):

Note: Delphi 1.0 calculated the date from year 1 instead of from 1899. To convert a Delphi 1.0 date to a Delphi 2.0 date, subtract 693594.0 from the Delphi 1.0 date. The date format changed to be more compatible with OLE 2.0 Automation.

So, there may be several possibilities depending on what you want to do:

1 - CONVERTING DELPHI2+ DATE TIME TO DELPHI 1
If you create a database with Delphi2.0+ and want to process it with Delphi1.0. The reasonable way is to convert all the date time values to Delphi 1.0 format. To do this something as follows for each record datetime field should be processed:
   Table1.FieldByName('MyDate').AsFloat :=  Table1.FieldByName('MyDate').AsFloat + 693594.0
2 - OPOSITE
If you create a database with Delphi 1 and want to convert it to Delphi 2+
   Table1.FieldByName('MyDate').AsFloat :=  Table1.FieldByName('MyDate').AsFloat - 693594.0

Here for your comments,
Regards,
Igor
0
 

Author Comment

by:tomcorcoran
ID: 1361355
Igor,

Thanks a million. Going from D1 to D3 skipping D2 I was not aware of this. I am also having problems with some dataaware controls reading fields that are set to zero (created in D1). Will I have to convert these tables in some way?

Thanks,

Tom.
0
 

Author Comment

by:tomcorcoran
ID: 1361356
Any other issues I might not be aware of moving from D1 to D3 (that were documented in D2)? Thanks, Tom.
0
 
LVL 5

Expert Comment

by:inter
ID: 1361357
Hi there,

I am happy that it works. Regarding the Changes between Delphi1.0 and 2.0+(since you have the changes from 2.0to 3.0) send me your email so that I can post you a technical document covering the code migration issues.

Bye, Igor
0
 

Author Comment

by:tomcorcoran
ID: 1361358
Igor, sounds good, I have seen that pannon-rex from peter illes, my e-mail is tomc@unitime.com, thanks, tom.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month10 days, 12 hours left to enroll

631 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