Convert from Double to DateTime

In Delphi we can cast the double value as datetime:

var
  dbl: Double;
  dt: TDateTime;
begin
  dbl := 65985.3333;
  dt := dbl;
end;

But in .NET we need call the  FromOADate method for DateTime class:

  Double dbl = 65985.3333;
  DateTime dt = DateTime.FromOADate(dbl)

Tags:

Comments are closed.