CalcLST


The CalcLST function returns the Local Sidereal Time for a date and time (UT or GMT) and a longitude. To get the Greenwich Sidereal Time, use a longitude of 0.

Syntax

dLST = CalcLST( sDate, sTime, sLongitude )

where

    sDate is a string specifying YMD (e.g., "2007,05,24").

    sTime is a string specifying the UT time (e.g., "18:24:41.5").

    sLongitude is a string giving the longitude, in degrees (e.g., "112 24 46.88"). West longitude is positive.

    dLST is the sidereal time, in decimal hours (e.g., 6.424468).

  

This function returns the Local Sidereal Time in decimal hours. To convert to a time string, use HrToHMS..

The date, time, and longitude values may use any number of commonly use field delimiters. Some examples are shown below:

     sDate:      "2007 05 24" "2007-05-24" "2007/05/24" "2007, 05, 24"

     sTime:      "18 24 41.5" "18:24:41.5" "18h24m41.5s" "18,24,41.5"

     sLongitude:      "112 24 46.88"      "112:24:46.88"      "112d24m46.88s"      "112,24,46.88"

Example

The following script calculates the local sidereal time for a date, time, and longitude.

sDate = "2005 09 28"

-- date: 28 Sept 2005

sTime = "05 15 34"

-- UT Time: 5h15m34s

sLong = "88 33 24"

-- longitude: 88 degrees west

dLST = CalcLST( sDate, sTime, sLong )

-- result is in decimal hours

sLST = HrToHms( dLST )

-- convert hours to time string

Printf("LST = %s\r\n", sLST )

-- Result: LST = 23:49:41.013

Related Topics

HrToHms

CalcSphAngle