gab said:
hello,
Can I convert a delphi date to java date?
for example I've this date : 37773,84 (delphi format)
and i must convert this in java Date.
thanks all
This might help. It's from the Delphi 7 help file
The integral part of a Delphi TDateTime value is the number of days that
have passed since 12/30/1899. The fractional part of the TDateTime value
is fraction of a 24 hour day that has elapsed.
Following are some examples of TDateTime values and their corresponding
dates and times:
0 12/30/1899 12:00 am
2.75 1/1/1900 6:00 pm
-1.25 12/29/1899 6:00 am
35065 1/1/1996 12:00 am
Given this you should be able to use a bit of maths to work it out.
In my rather simple mind it should be as easy as
Calendar c = Calendar.getInstance();
c.set(1899,11,30,0,0);// init delphi version of start of time
// months go 0..11
c.add(Calendar.DATE,37773); // add in the days
c.add(Calendar.MINUTE,(int)((60*24) * 0.84)); // add the minutes
SimpleDateFormat sdf = new SimpleDateFormat();
System.out.println(sdf.format(c.getTime())); // voila