SIDEREAL CLOCK JAVASCRIPT
Local Time
UTC Time (GMT) GMST Angle GMST
Local Longitude
Year Day LST Angle
Local Sidereal Time
Source

Calculating Your Local Sidereal Time (LST)

By now you can see how useful it would be to know your LST. I have yet to do this but I think it would be way cool. For now, I’ll just write software to do the calculations. I’m going to demo one that takes your current longitude and any given local civil date and time (Pacific Standard Time in my case) and calculates the LST.

All source code is checked into my GitHub repo. It's a simple console app written in C#. The first is my longitude in decimal degrees for Portland, Oregon. The second and third are my local date and time on the vernal equinox. If you build and run the app yourself from a command prompt you should supply the three args yourself.

Here are the steps:

  1. Given the local longitude, date and time.
  2. Convert the date and time to UTC.
  3. Calculate Greenwich mean sidereal time (GMST).
  4. Using the local longitude, shift GMST to LST.
  5. Display LST in hours, minutes, and seconds.

The calculations come in part from the book Astronomical Algorithms by Jean Meeus (2nd Edition). Meeus tells us how to derive mean sidereal time at Greenwich (GMST). Once we have GMST From there I'm going to add my own calculations to convert to LST.

Given the UTC of a given date and moment in time we must first convert it to the Julian Day (JD) and then use that to get Time T (time in Julian centuries). These are standard preliminary calculations that I've been doing  throughout this series. See my previous post on the Julian Day. Of the three formulas Meeus gives I'll use:

       θ0 = 280.46061837 + 360.98564736629 (JD - 2451545.0) + 0.000387933 T2 - T3 / 38710000.0

Meeus will get us to GMST. From there I'll use local longitude (L) to convert GMST to LST:

       LST = GMST + L