Solved

decode date problems in d3

Posted on 1998-04-08
5
236 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now