convert delphi TDateTime to php

I am having troubles converting Delphi Tdatetime integer into normal date and time values.

I have a SQLExpress database with date and time fields that are integers. My STARTDATE has the integer 40924 wich should be 16-01-2012 and my STARTTIME has the integer 55200 wich should be 15:35:00

Now I have the following script in php:

					$delphi = $row['STARTDATE'];
					$unix = 25569;
					$datum = $delphi-$unix;
					if ($datum<0){
					$datum=0;
					}
					$unixtime = strtotime("1 january 1970 + $datum days");
					echo date('d-m-Y', ($unixtime));

It converts the Delphi time to unix. And this works for the date (STARTDATE) but it doesn’t work for the time (STARTTIME).

Now is there anyway to do this better?
The main question is: How can I convert a Delphi DateTime integer into normal date time view in PHP?

What format is the time in? Does the integer measure a time since a date or a position in a week?

I have solved it :stuck_out_tongue: The delphi to unix time stamp as discriped in the above code works. The other time field is seconds from 0:00:00 so gmdate() solved that one for me :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service