.. include:: references.txt .. _astropy-time: **************************************************** Time and Dates (`astropy.time`) **************************************************** .. |Quantity| replace:: :class:`~astropy.units.Quantity` .. |Longitude| replace:: :class:`~astropy.coordinates.Longitude` .. |EarthLocation| replace:: :class:`~astropy.coordinates.EarthLocation` .. |SkyCoord| replace:: :class:`~astropy.coordinates.SkyCoord` Introduction ============ The `astropy.time` package provides functionality for manipulating times and dates. Specific emphasis is placed on supporting time scales (e.g. UTC, TAI, UT1, TDB) and time representations (e.g. JD, MJD, ISO 8601) that are used in astronomy and required to calculate, e.g., sidereal times and barycentric corrections. It uses Cython to wrap the C language `ERFA`_ time and calendar routines, using a fast and memory efficient vectorization scheme. All time manipulations and arithmetic operations are done internally using two 64-bit floats to represent time. Floating point algorithms from [#]_ are used so that the |Time| object maintains sub-nanosecond precision over times spanning the age of the universe. .. [#] `Shewchuk, 1997, Discrete & Computational Geometry 18(3):305-363 `_ Getting Started =============== The basic way to use `astropy.time` is to create a |Time| object by supplying one or more input time values as well as the `time format`_ and `time scale`_ of those values. The input time(s) can either be a single scalar like ``"2010-01-01 00:00:00"`` or a list or a `numpy` array of values as shown below. In general any output values have the same shape (scalar or array) as the input. >>> import numpy as np >>> from astropy.time import Time >>> times = ['1999-01-01T00:00:00.123456789', '2010-01-01T00:00:00'] >>> t = Time(times, format='isot', scale='utc') >>> t