Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

decode date problems in d3

Posted on 1998-04-08
5
Medium Priority
?
258 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 400 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

670 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