Solved

decode date problems in d3

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

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
Intraweb submit form as a POST request 4 349
Connection between libmysql.dll and MySQL Versions 7 117
Show Listview image from database (String field) 5 143
Delphi Yen format 3 57
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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

679 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