I’m trying to convert the value returned by Now() to double and then use it in a different function, ie.
procedure TForm1.FormCreate(Sender: TObject);
begin
MyFunction_1(Now);
end;
procedure MyFunction_1(TheTime : Double);
begin
MyFunction_2(TheTime);
end;
procedure MyFunction_1(ModificationDate : Double);
begin
if JulianDateToDateTime(ModificationDate) < 12345 then
...
end;
But the problem is, the current time value isn’t passed correctly. A simple test for JulianDateToDateTime(Now); returned something like this:
0/0/0000 16:10:16
I’m pretty sure it’s something really basic, I just can’t figure out what’s it is
Any help please?!!
You’re doing it backward. 🙂
JulianDateToDateTimetakes a Julian date as a parameter and returns a TDateTime. It does’t take a TDateTime as an argument; that’s why you’re getting the wrong result. I think you mean to go the other way (DateTimeToJulianDate).From the Delphi documenation:
Here’s a quick sample showing the difference:
Here’s the output:
Note that adding one more variable of
TDateTimetype and trying to useJulianDateToDateTimeraises a range exception: