Link to home
Start Free TrialLog in
Avatar of jbreg
jbreg

asked on

Delphi DateTime Format--What is it?

I have to convert Delphi DateTimes like this 38837.0129173727 to regular date times. What format are Delphi Times in anyway so I can know how to do the conversion?
Avatar of 2266180
2266180
Flag of United States of America image

there are some functions to convert delphi date times to system date times: DateTimeToSystemTime or DateTimeToTimeStamp or DateTimeToFileDate and other such functions which you can find in dateutils (D6+)
Avatar of jbreg
jbreg

ASKER

I should have prefaced this by saying I can't work within delphi. The Delphi Date times are produced in a text file which I need to parse using ASP / PHP. Therefore I need to actually know and do the conversion myself.
Its up to you really how you want to format it.

FormatDateTime('yyyy-mm-dd hh:nn:ss:xxx', 38837.0129173727)  // cant remember the millisecond letter at position xxx sorry off the top of my head

would be one example.
Avatar of jbreg

ASKER

The FormatDateTime is a delphi function. I can't use that because I am using PHP. I need to understand what this function does and in what format 38837.0129173727 is? Is it seconds since 1979, etc?
ASKER CERTIFIED SOLUTION
Avatar of 2266180
2266180
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello Sir,

  The DateTime value type holds a date and time. The value may range from 00:00:00 on January 1, 0001 AD to 23:59:59 on December 31, 9999 AD according to the Gregorian Calendar.
 
Internally, the value is stored as a number of 100 nanosecond (0.0000001 second) ticks since 00:00:00 Jan 1 0001 AD.
 
Note: : The MSDN remarks about DateTime gives the start date/time as 01 Jan 0001 12:00:00 midnight.
 
DateTime values are never updated (the value is said to be immutable) - any changes always result in a new DateTime value being returned.
 
Use the TimeSpan to hold a time interval. For example, 2 hours, or 4 days plus 6 hours. A TimeSpan value can be added or subtracted from a DateTime value.
 
DateTime looks very much like a class - in .Net it is called a structure because it is always fixed in size, and can be more efficiently handled. It cannot be inherited from.

In delphi FormatDateTime('dd/mm/yyyy', 38837.0129173727) will give you 30/04/2006, which is similar to what mikelittlewood says.

Hope this information helps you.

with regards,
padmaja.
Avatar of Eddie Shipman
Ok, everyone, I don't think you've quite gotten what the OP is asking.

He is trying to take a Delphi Datetime, which is an Extended value, stored as text,
and convert it via PHP, to a PHP timestamp.

I have been helping him in the PHP area and hope to have something for him
soon. His PHP DateAdd function is faulty.
Personally, I think this question doesn't belong in the Delphi area and will continue the thread
in the PHP area.
I agree :)