<p>There isn't a formula for converting Unix epoch to universal time.  This is because universal time is based on the rotation of the Earth, which is not constant (at the level of accuracy achieved by atomic clocks).</p>
<p>But UTC is &quot;coordinated&quot; to UT by the addition of leap seconds.  This means that UTC will never be more than 0.9 seconds out from UT.  It is quite possible that for your purposes, <strong>you may assume UT=UTC.</strong> This is especially true if your unix timestamps have been collected from a regular computer, or if the time stamps have been given as integers (as most computer clocks can't be trusted to sub-second accuracy)</p>
<p>If you do need sub-second accuracy you may use <a href="https://en.wikipedia.org/wiki/Coordinated_Universal_Time" rel="nofollow noreferrer">a graph like the one on Wikipedia</a>.  This shows how many seconds you need to add or subtract from UTC to get UT. (the data used to create this graph is linked to from the Wikipedia page).</p>
<p><a href="https://i.sstatic.net/yst2K.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/yst2K.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2023-04-24T21:38:56.877Z
2023-04-24T21:38:56.877Z
James K
<p>I think one simple way to do this is with astropy. The following code uses the unix time and the Earth location of an address to calculate the sidereal time.</p>
<pre><code>import astropy.time
import astropy.coordinates
import astropy.visualization

time = astropy.time.Time(
    val=[1682375763, 1682375764, 1682375765, ],
    format=&quot;unix&quot;,
    location=astropy.coordinates.EarthLocation.of_address(&quot;Bozeman, MT&quot;)
)

time_sidereal = time.sidereal_time(&quot;apparent&quot;)

print(time_sidereal)
</code></pre>
<p>which prints</p>
<pre><code>[5h22m39.19199396s 5h22m40.19473194s 5h22m41.19746992s]
</code></pre>

CC BY-SA 4.0
2023-04-24T22:43:16.153Z
2023-04-24T22:43:16.153Z
Roy Smart
<p>I am an astro-particle physicist looking for some simulation based on the experiment observation.</p>
<p>The simulation dataset contains 10 digit Epoch dataset for UTC time, however, I need to convert this into LST.</p>
<p><a href="https://www.epochconverter.com/" rel="nofollow noreferrer">https://www.epochconverter.com/</a></p>
<p>Fortunately, I could find a converting website for 10 digit Unix epoch to actual UTC time, however, I could not find out how could I convert it into LST.</p>
<p><a href="https://astronomy.stackexchange.com/questions/24859/local-sidereal-time">Local Sidereal Time</a></p>
<p>Here is also a formula but I don't know the formula for UTC to UT (Universe time), so I don't think using this will help me a lot for my purpose.</p>
<p>If anyone can offer me nice converting formula, it would be great.</p>

CC BY-SA 4.0
2023-04-24T23:07:40.047Z
The IERS publishes UTC-UT1 every day: https://www.iers.org/IERS/EN/DataProducts/EarthOrientationData/eop.html .  Also be aware there is *apparent sidereal time* and *mean sidereal time*, you should look in to both to determine which you need.  If you're looking at UTC-UT1, my bet is you want *apparent*.
Greg Miller
CC BY-SA 4.0
2023-04-25T04:13:13.343Z
Note that Unix / POSIX timestamps are *kind of* synchronised to UTC, but there are problems with leap seconds. See https://unix.stackexchange.com/q/283164/88378
PM 2Ring
CC BY-SA 4.0
2023-04-25T04:13:51.617Z
From https://www.ucolick.org/~sla/leapsecs/right+gps.html The POSIX standard requires that the value of time_t have a simple relationship to date and time where each day has 86400 seconds. Such a requirement demands that POSIX systems not count leap seconds because they produce days which have 86401 seconds. The POSIX standard also specifies that the time and date values be UTC. UTC has had leap seconds, so the combination of the two requirements is inconsistent with the broadcast time signals that are used to set system clocks.
PM 2Ring
<time>
Converting UTC (10 digit) to LST (Local Sidereal Time)
Kyle
# Converting UTC (10 digit) to LST (Local Sidereal Time)

(Asked by: username_0 on 2023-04-24)

I am an astro-particle physicist looking for some simulation based on the experiment observation.

The simulation dataset contains 10 digit Epoch dataset for UTC time, however, I need to convert this into LST.

<https://www.epochconverter.com/>

Fortunately, I could find a converting website for 10 digit Unix epoch to actual UTC time, however, I could not find out how could I convert it into LST.

[Local Sidereal Time](https://astronomy.stackexchange.com/questions/24859/local-sidereal-time)

Here is also a formula but I don't know the formula for UTC to UT (Universe time), so I don't think using this will help me a lot for my purpose.

If anyone can offer me nice converting formula, it would be great.

**Tags:** time

> **Comments:**
> **username_1**: The IERS publishes UTC-UT1 every day: https://www.iers.org/IERS/EN/DataProducts/EarthOrientationData/eop.html .  Also be aware there is *apparent sidereal time* and *mean sidereal time*, you should look in to both to determine which you need.  If you're looking at UTC-UT1, my bet is you want *apparent*.  
> **username_2**: Note that Unix / POSIX timestamps are *kind of* synchronised to UTC, but there are problems with leap seconds. See https://unix.stackexchange.com/q/283164/88378  
> **username_2**: From https://www.ucolick.org/~sla/leapsecs/right+gps.html The POSIX standard requires that the value of time_t have a simple relationship to date and time where each day has 86400 seconds. Such a requirement demands that POSIX systems not count leap seconds because they produce days which have 86401 seconds. The POSIX standard also specifies that the time and date values be UTC. UTC has had leap seconds, so the combination of the two requirements is inconsistent with the broadcast time signals that are used to set system clocks.  

---

## 2 answers

### Answer by username_3 on 2023-04-24. Score: 3 | Accepted answer

There isn't a formula for converting Unix epoch to universal time. This is because universal time is based on the rotation of the Earth, which is not constant (at the level of accuracy achieved by atomic clocks).

But UTC is "coordinated" to UT by the addition of leap seconds. This means that UTC will never be more than 0.9 seconds out from UT. It is quite possible that for your purposes, **you may assume UT=UTC.** This is especially true if your unix timestamps have been collected from a regular computer, or if the time stamps have been given as integers (as most computer clocks can't be trusted to sub-second accuracy)

If you do need sub-second accuracy you may use [a graph like the one on Wikipedia](https://en.wikipedia.org/wiki/Coordinated_Universal_Time). This shows how many seconds you need to add or subtract from UTC to get UT. (the data used to create this graph is linked to from the Wikipedia page).

[![enter image description here](https://i.sstatic.net/yst2K.png)](https://i.sstatic.net/yst2K.png)


---

### Answer by username_4 on 2023-04-24. Score: 1

I think one simple way to do this is with astropy. The following code uses the unix time and the Earth location of an address to calculate the sidereal time.
import astropy.time
import astropy.coordinates
import astropy.visualization

time = astropy.time.Time(
    val=[1682375763, 1682375764, 1682375765, ],
    format="unix",
    location=astropy.coordinates.EarthLocation.of_address("Bozeman, MT")
)

time_sidereal = time.sidereal_time("apparent")

print(time_sidereal)

which prints
[5h22m39.19199396s 5h22m40.19473194s 5h22m41.19746992s]


---

