from typing import Union


def seconds_to_datetime(seconds: Union[float, int]) -> str:
  """Convert seconds to datetime string."""
  # NOTE(xames3): Inspired from `timedelta` class of datetime module.
  mm, ss = divmod(int(seconds), 60)
  hh, mm = divmod(mm, 60)
  dd, hh = divmod(hh, 24)
  return f"{dd:02d}:{hh:02d}:{mm:02d}:{ss:02d}"