.. _astropy-time: ******************************* Time and Dates (`astropy.time`) ******************************* 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, for example, sidereal times and barycentric corrections. The `astropy.time` package is based on fast and memory efficient PyERFA_ wrappers around the ERFA_ time and calendar routines. 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 usual 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. Examples -------- .. EXAMPLE START: Creating a Time Object with astropy.time To create a |Time| object: >>> 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