OpenGNSSLabSPP

Module 1 - Foundations

GPS Time Conversion

Convert a GPS-time calendar timestamp into Julian Date and GPS seconds-of-week.

Difficulty

Fundamentals

Estimated time

14 minutes

Series position

1 of 10

GPS time conversion, in brief

GPS time is a continuous time scale counted from the GPS epoch. This example converts a calendar timestamp already expressed in GPS time into Julian Date, GPS week and seconds-of-week. Converting a UTC timestamp first requires the applicable GPS−UTC offset; that is a separate operation.

Prepared by OpenGNSSLabUpdated Sources, reproducibility and corrections

Learning objectives

  • Extract date-time components for GNSS processing.
  • Compute Julian Date with the Gregorian calendar formula.
  • Convert elapsed GPS seconds into seconds-of-week.

Why GPS time is the first numerical dependency

Every observation equation needs a time tag. RINEX observations, broadcast navigation records, SP3 epochs, satellite clocks, and Earth rotation corrections all depend on consistent time handling.

GPS time starts at 1980-01-06 00:00:00 GPST and is handled as a continuous count. This example assumes the calendar timestamp is already expressed in GPST; convert UTC with the epoch-appropriate leap-second offset before applying these steps. In many single-epoch algorithms, the useful quantity is seconds-of-week.

Step 1

Extract the date-time components

For the example timestamp `2024-01-01 01:59:44`, split the string into integer components.

year=2024,month=1,day=1,hour=1,minute=59,second=44year=2024,\quad month=1,\quad day=1,\quad hour=1,\quad minute=59,\quad second=44

Step 2

Compute the Julian Date

Use the Gregorian calendar conversion. The time-of-day term shifts the day boundary to noon, which is standard for Julian Date.

a=⌊14−month12⌋=1a=\left\lfloor\frac{14-month}{12}\right\rfloor=1
y=year+4800−a=6823,m=month+12a−3=10y=year+4800-a=6823,\qquad m=month+12a-3=10
JD=day+⌊153m+25⌋+365y+⌊y4⌋−⌊y100⌋+⌊y400⌋−32045JD=day+\left\lfloor\frac{153m+2}{5}\right\rfloor+365y+\left\lfloor\frac{y}{4}\right\rfloor-\left\lfloor\frac{y}{100}\right\rfloor+\left\lfloor\frac{y}{400}\right\rfloor-32045
JD=2460000.083148148JD = 2460000.083148148

Step 3

Convert Julian Date to GPS seconds-of-week

Subtract the GPS epoch Julian Date, multiply by seconds per day, then reduce modulo one GPS week.

JDGPS=2444244.5JD_{GPS}=2444244.5
GPSelapsed=(JD−JDGPS)×86400GPS_{elapsed}=(JD-JD_{GPS})\times 86400
GPSSOW=GPSelapsed mod 604800=93584.00001978874 sGPS_{SOW}=GPS_{elapsed}\bmod 604800 = 93584.00001978874\ \text{s}

Minimal implementation

from datetime import datetime

def gps_seconds_of_week(value: str) -> float:
    dt = datetime.strptime(value.split('.')[0], '%Y-%m-%d %H:%M:%S')
    a = (14 - dt.month) // 12
    y = dt.year + 4800 - a
    m = dt.month + 12 * a - 3
    jd = dt.day + ((153 * m + 2) // 5) + 365 * y + y // 4 - y // 100 + y // 400 - 32045
    jd += (dt.hour - 12) / 24 + dt.minute / 1440 + dt.second / 86400
    return ((jd - 2444244.5) * 86400) % 604800

Common mistake

Do not mix GPS Time and UTC without accounting for leap seconds. For RINEX/SP3 workflows, always verify which time scale the file uses before combining records.

Result

Computed result

93584.00001978874 s

The timestamp falls at about 93,584 seconds into the GPS week.

What you should understand now

  • GPS seconds-of-week is a modulo-reduced time variable.
  • Julian Date conversion is deterministic but easy to shift by 12 hours if the time fraction is handled incorrectly.
  • This time value becomes an input to satellite clock, orbit, and interpolation steps.

Related tutorials

Help improve this tutorial

Point out numerical ambiguity, missing prerequisites, or a step that needs a fuller derivation.

Primary sources and further reading

The specifications and research below support the model and terminology. Numerical exports and teaching assumptions are documented in the lesson itself.

Browse the scientific reference library →

Continue with the numbers

GNSS terms and units · Report a correction