TDateTime with Delphi XE and Win 7 64-bit

Following on from thread 29082 (ShortDateFormat problem with Windows 7 64-bit & Delphi 2007) it gets even stranger.  I am also running Delphi on Win 7 64, but XE rather than 2007.

I followed a variation of the discussion in that thread to get the correct short date order for the UK, which is *dd/mm/yyyy*.  I then obtained a Y,M,D triplet (1943,2,19) which I passed to EncodeDate.  The string returned in the debugger was 2/19/1943, and the TDateTime value passed back to my application had day and month reversed.  If I then passed this back to the date routines it was treated as an invalid date.

I have been using TDateTime throughout.  The debugger now echoes the date value rather than the numeric value, which in Delphi 2007 would have been 15756.

I then changed all of my TDateTIme declarations to Double.  The (now) Double value passed to the application now has the correct date value.  The odd part is that this is the *only* change I made to move from an incorrect date format to a correct date format.  The difference between TDateTime and Double is pure syntactic sugar, as far as I can see.  How can recasting TDateTime to Double change the behaviour of the compiled code - or is there some weird RTTI stuff going on?
0
Dan
7/27/2011 2:46:39 PM
embarcadero.delphi.general 4258 articles. 0 followers. Follow

3 Replies
1177 Views

Similar Articles

[PageSpeed] 20
Get it on Google Play
Get it on Apple App Store

Dan Hamm wrote:

> I have been using TDateTime throughout.  The debugger now echoes the
> date value rather than the numeric value, which in Delphi 2007 would
> have been 15756.

It seems to me that your entire problem is the debugger trying to help
you out by formating the tDateTime (which is and has always been a
double) as a string.

Can you post some sample code that demonstrates the problem you're
having?

-- 
-Mike (TeamB)
0
Mike
7/30/2011 2:46:56 AM
Dan Hamm wrote:

> Following on from thread 29082 (ShortDateFormat problem with Windows 7 64-bit & Delphi 2007) it
> gets even stranger.  I am also running Delphi on Win 7 64, but XE rather than 2007.
> 
> I followed a variation of the discussion in that thread to get the correct short date order for
> the UK, which is *dd/mm/yyyy*.  I then obtained a Y,M,D triplet (1943,2,19) which I passed to
> EncodeDate.

Dan, EncodeDate takes three parameters, Year, Month and Day and if you pass 1943, 2 and 19 (in this
order) to EncodeDate, the TDateTime value is for sure correct (15756) regardless of any locale
settings.

> The string returned in the debugger was 2/19/1943,

The debuggers datetime visualizer obviously did not get the correct locale setting from the OS.
Did you try the procedure mentioned in the referenced thread, to change the locale setting in the
Windows Control Panel back and forth? This seemed to have helped others.

> and the TDateTime value passed
> back to my application had day and month reversed.

How did you determine that?

> If I then passed this back to the date
> routines it was treated as an invalid date.

What do you mean with 'this', the TDateTime value or the string that the debugger was showing?
What date routine do you refer to?

Since the integer part of a TDateTime is the number of days since 30.12.1899 all values (within its
valid range) represent a valid date.

If you refer to the wrongly formatted debugger string, then that would indeed be considered invalid
if the date routine you passed the string to would expect the 'dd/mm/yyy' format.

> I have been using TDateTime throughout.  The debugger now echoes the date value rather than the
> numeric value, which in Delphi 2007 would have been 15756.

You can change the display of TDateTime values in Tools - Options - Debugger Options - Visualizers.

Cheers
Tom


-- 
Tom Brunberg
0
Tom
8/1/2011 10:10:20 AM
> {quote:title=Dan Hamm wrote:}{quote}
> Following on from thread 29082 (ShortDateFormat problem with Windows 7 64-bit & Delphi 2007) it gets even stranger.  I am also running Delphi on Win 7 64, but XE rather than 2007.
> 
> I followed a variation of the discussion in that thread to get the correct short date order for the UK, which is *dd/mm/yyyy*.  I then obtained a Y,M,D triplet (1943,2,19) which I passed to EncodeDate.  The string returned in the debugger was 2/19/1943, and the TDateTime value passed back to my application had day and month reversed.  If I then passed this back to the date routines it was treated as an invalid date.
> 
> I have been using TDateTime throughout.  The debugger now echoes the date value rather than the numeric value, which in Delphi 2007 would have been 15756.
> 
> I then changed all of my TDateTIme declarations to Double.  The (now) Double value passed to the application now has the correct date value.  The odd part is that this is the *only* change I made to move from an incorrect date format to a correct date format.  The difference between TDateTime and Double is pure syntactic sugar, as far as I can see.  How can recasting TDateTime to Double change the behaviour of the compiled code - or is there some weird RTTI stuff going on?

This is most likely the Win7 regional settings issue, where the default region on a new install retains a US setting. If you change the regional setting format to US and the system locale to US, save, then change back to the UK in both, Delphi will behave correctly. This is not a Delphi issue as it also arises with MS Excel and other programs not written in Delphi
0
Jeff
1/8/2012 9:44:17 AM
Reply:

Similar Artilces:

Delphi 7 to Delphi XE
Have been using Delphi 7 for many moons ( have got later versions but never upgraded to ) My first problem is: Component Palette. in XE it is a small toolbar docked in top right in Delphi 7 it gives a large view of all the components. I am struggling to be able to cope/access my components.in Delphi XE. Can I make the component pallette tool bar the same size as Delphi 7, or is there a fast way to view/choose all available components in XE, that I have not spotted yet? Kind Regards, Robert. Hi, What I know is that in Delphi 2010 and XE you can choose between t...

Delphi Prism installed on Win 7 64 bit?
Is there, or should there be, any reason why Delphi Prisom 2010 would not install on Windows 7 64-bit? I found that it did not, but I think the problem was with the VS 2008 portion of the installation. Thanks, Bill Le 11.06.2010 22:42, William Meyer a écrit : > Is there, or should there be, any reason why Delphi Prisom 2010 would > not install on Windows 7 64-bit? I found that it did not, but I think > the problem was with the VS 2008 portion of the installation. > > Thanks, > > Bill Bill, In my Windows 7 64-bits, I have installed VS2008 with Delp...

Occasional errors with 32-bit Delphi 7 application on Windows 7 64-bit
Hi, I have a 32-bit Delphi 7 application which was deployed on some machines with Windows 7 64-bit. The application occasionally displays errors such as: "Error reading ppDBText37.Border.Color: Invalid property value" or "Error reading Label24.Font.Ch: Property Ch does not exist" (here the name "Charset" was apparently truncated to "Ch") I checked how those properties are declared on the form where the errors occurred, and all seems ok: - First form (where "Error reading ppDBText37.Border.Color: Invalid property value" occurs): ...

Need info on Game type graphics using Win 7 64 and Delphi XE
Hi all, I'm trying to educate myself from the bottom up on Game design and programming with Delphi XE, its capabilities and comparison to other languages. Specifically I would like to find a way to incorporate the maps for large sandbox environments into a utility feature that would allow owners of a game to load maps up and move about them, navigating and seeing them exactly as they appear in the original game. Such would be useful for commanders to plan team assaults in games like CoD or Battlefield. Unfortunately I haven't had much luck in my research so far. E...

Windows 7 and Delphi 7, 32 or 64 bit?
I am in the process of getting a new PC and these days there is a choice between 32 and 64 bit operating system (Win7). I have both Delphi7 Pro and BDS2006, where most of my work tends to still be done in Delphi 7. My question now is: Does Delphi 7 work correctly in Windows 7 x64 or do I have to install the 32 bit version in order to work with Delphi 7? This is about the IDE, not programs created with Delphi, which I already know work fine in Win7x64. I am worried about the impact of new security measures in Win7 and incompatibilities between the Delphi7 debugger and Win7x64..... Bo ...

Migrating to Delphi XE from Delphi 7.0
Below is my code in Delphi 7.0, this is how to call another units in webmodule... Hello All, I create a web application in Delphi 7.0, using the Web Server Application, CGI, IntraWeb 7.0.15. And I used TIWPageProducer to view like this url "http://localhost/mcr/mcr.exe/main". I built and run. I viewed in thru IIS and it is running... This is my code in Delphi 7.0 .... .... procedure TWebModule1.proMainGetForm(ASender: TIWPageProducer; AWebApplication: TIWApplication; var VForm: TIWPageForm); begin VForm := TfrmMain.Create(AWebApplication); end; procedure TWebModule1....

Delphi 64 bit / Future Direction of Delphi
I am responding to the various requests for 64 bit and the discussion about the future direction of Delphi. I have a small company - we write software for new and used auto dealerships - sales and finance - coming out with accounting now and parts and service in the next few years. Our customers don't care about 32 bit vs 64 bit, etc. They want me to provide simple and convenient solutions to make their jobs easier. We have stuck with Delphi 5 for many years - I should have upgraded 5 years ago but it did the job. We are now in the early stages of a significant up...

Migrating to Delphi XE from Delphi 7.0
Below is my code in Delphi 7.0, this is how to call another units in webmodule... Hello All, I create a web application in Delphi 7.0, using the Web Server Application, CGI, IntraWeb 7.0.15. And I used TIWPageProducer to view like this url "http://localhost/mcr/mcr.exe/main". I built and run. I viewed in thru IIS and it is running... This is my code in Delphi 7.0 .... .... procedure TWebModule1.proMainGetForm(ASender: TIWPageProducer; AWebApplication: TIWApplication; var VForm: TIWPageForm); begin VForm := TfrmMain.Create(AWebApplication); end;...

Installation of Delphi 7 onto Windows 7 64 bit platform.
Hello, I am attempting to install Delphi 7 onto Windows 7, 64 bits, and keep getting the message: " Unable to rename C:\Program Files (x86)\Borland\Delphi7\Bin\delphi32.$$$ to 'C:\Program Files (x86)\Borland\Delphi7\Bin\delphi32.dro' ". How do I get around this error, or is it even possible? Thank you very much in advance. John Shyer John Shyer wrote: >Hello, > >I am attempting to install Delphi 7 onto Windows 7, 64 bits, and keep >getting the message: " Unable to rename C:\Program Files >(x86)\Borland\Delphi7\Bin\delphi32.$$$ to '...

Delphi 7.0 code convert to delphi XE ...
Hello All, I create an application using Web Server Application then CGI stand alone... In WebModule I add ModuleController component and IWPageProcedure... Below is my code in Delphi 7.0, this is how to call another units in webmodule... .... .... procedure TWebModule1.proMainGetForm(ASender: TIWPageProducer; AWebApplication: TIWApplication; var VForm: TIWPageForm); begin VForm := TfrmMain.Create(AWebApplication); end; procedure TWebModule1.proLogInGetForm(ASender: TIWPageProducer; AWebApplication: TIWApplication; var VForm: TIWPageForm); begin VForm := TfrmLogIn.Create(AWebA...

Delphi 7 to Delphi XE: TBlobField to XML [Edit]
Hi, I'm migrating a Delphi7 application to Delphi XE. I'm using a TClientDataSet to communicate, by using a XML frame, with my server. In this TClientDataSet I'm using a TBlobField which is an array of 384 byte. The blobField is allocate by a code like this : {code} myStream : TStream; myStream := aClientDataSet.CreateBlobStream(myBlobField, bmwrite); vResult := myStream.Write(ArrayOf384Byte[0], length(ArrayOf384Byte)); //vResult = 384 => GooD ! (...) {code} For communicate with the server, we have to decode the Blobfield in XML before to sending it. We have...

How to access Delphi 7 & 2009 after purchasing Delphi XE
I have purchased and installed Delphi XE and now I'm unable to find information on how to download previous versions of Delphi, namely Delphi 7 and 2009. Please respond. Regards, SB, L&T Hi sushweta biswas, > I have purchased and installed Delphi XE and now I'm unable to find information on how to download previous versions of Delphi, namely Delphi 7 and 2009. Your reseller should have told you: after registering Delphi XE, you can go to http://www.embarcadero.com/xe-earlier-versions to enter your serial number of Delphi XE as well as your EDN account informati...

Problem upgrading web service client from Delphi 7 to Delphi XE
In trying to upgrade our web service client to Delphi XE we have now get a web service error of Invalid Format. When we examine the SOAP request we see the following differences from Delphi 7 vs Delphi XE In Delphi 7 we get <SomeStuff xmlns="" xsi:nil="true" /> In Delphi XE we get <SomeStuff xsi:nil="true" /> We have narrowed the failure down to these differences in the client request. Is there anyway to get Delphi XE to generate a SOAP request with the xmlns attribute set to blank as it used to be? Hello, > In trying to u...

Delphi XE install problem on Win 7
hello, After install and try to load Delphi give a messsage : Exception EpackageRegistrationException dans le module coreide150.bpl en 0006c339. Procédure d'enregistrement, Pasreg.IDERegister dans le package c\programe....\bin\delphide.bpl a généré la classe d'exception EInOutError : Mismatched borrower. how to execute Delphi ? Best regards, Eric sailly eric wrote: > hello, > > After install and try to load Delphi give a messsage : > Exception EpackageRegistrationException dans le module coreide150.bpl en 0006c339. Procédure d...

Web resources about - TDateTime with Delphi XE and Win 7 64-bit - embarcadero.delphi.general

XG File format
{********************************* XG FILE FORMAT *********************************(c) 2009-2014 GameSite 2000 Ltd;This information can be freely ...

A simple Delphi wrapper for Sqlite 3
Most applications use a database, and there are many excellent database engines to choose from, both free and commercial. SQLite is a smal

Reference for unit 'System': Procedures and functions
[ Overview ][ Constants ][ Types ][ Classes ][Procedures and functions][ Variables ][ Index ] Reference for unit 'System' ( #rtl ) Reference ...

Reference for unit 'System': Types
[ Overview ][ Constants ][Types][ Classes ][ Procedures and functions ][ Variables ][ Index ] Reference for unit 'System' ( #rtl ) Reference ...

Resources last updated: 12/16/2015 5:26:40 PM