Solved

decode date problems in d3

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi Form ownership 4 160
Breakpoint doesn't stop in my variable 3 49
Browsing a TTreeView in Delphi 5 50
migrate this code to work on android 1 46
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…

710 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