Skip to main content
Ctrl+K

caput v25.3.1.post103+git.c9762dd5

  • User Guide
  • Installation
  • API Reference
  • GitHub
  • User Guide
  • Installation
  • API Reference
  • GitHub

Section Navigation

  • caput.algorithms
  • caput.astro
    • caput.astro.constants
    • caput.astro.coordinates
    • caput.astro.observer
    • caput.astro.skyfield
    • caput.astro.time
      • datetime_to_timestr
      • datetime_to_unix
      • ensure_unix
      • era_to_unix
      • leap_seconds_between
      • naive_datetime_to_utc
      • time_of_day
      • timestr_to_datetime
      • unix_to_datetime
      • unix_to_era
  • caput.config
  • caput.containers
  • caput.memdata
  • caput.mpiarray
  • caput.pipeline
  • caput.util
  • caput
  • caput.astro
  • caput.astro.time
  • datetime_to_unix

datetime_to_unix#

caput.astro.time.datetime_to_unix(dt)[source]#

Converts a datetime object to the unix time.

This is the inverse of datetime.datetime.utcfromtimestamp().

Parameters:
dtdatetime | array_like

datetime object(s) to convert to unix.

Returns:
unix_timearray_like

Unix time.

See also

unix_to_datetime()
datetime.datetime.utcfromtimestamp()

previous

datetime_to_timestr

next

ensure_unix

On this page
  • caput.astro.time.datetime_to_unix()

© Copyright 2013-2026 Liam Gray, Kiyoshi Masui and J. Richard Shaw.

Created using Sphinx 8.2.3.

Built with the PyData Sphinx Theme 0.16.1.