Skip to main content

Time Commands

Time system conversions and calculations.

Commands

starward time now

Display current time in multiple formats.

starward time now

Output includes UTC, Julian Date, Modified Julian Date, and Unix timestamp.

starward time convert

Convert between time formats.

# From Julian Date
starward time convert 2451545.0

# From ISO date
starward time convert "2000-01-01T12:00:00"

# From Unix timestamp
starward time convert 946728000

starward time jd

Get Julian Date for a specific time.

starward time jd "2024-06-21 12:00:00"

Time Systems

SystemDescription
JDJulian Date — days since Jan 1, 4713 BC
MJDModified JD — JD minus 2400000.5
UnixSeconds since Jan 1, 1970
LSTLocal Sidereal Time

Examples

# Current time with verbose calculation
starward time now --verbose

# JSON output for scripting
starward time now --json

# Convert J2000.0 epoch
starward time convert 2451545.0

Python API

from starward import JulianDate, jd_now, utc_to_jd

# Current time
now = jd_now()
print(f"JD: {now.jd}")

# Convert from datetime
from datetime import datetime
jd = utc_to_jd(datetime(2024, 6, 21, 12, 0, 0))

# Access properties
print(f"T (centuries since J2000): {jd.t_j2000}")