# utcToRinexWeek

Industry: GNSS

## Signature

```ts
utcToRinexWeek(system: RinexWeekSystem, utcString: string): RinexWeek | null
```

Return the RINEX navigation-file week and seconds of week of a UTC instant.

- The inverse of `rinexWeekToUtc`; the week is continuous, so there is no era.
- GPS, QZSS, NavIC and Galileo weeks count from 1980-01-06; BeiDou weeks from 2006-01-01.
- `null` before the system's epoch, for an instant past 9999-12-31T23:59:59.999999999Z (the inverse writes four-digit years only), and on invalid input.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `system` | `RinexWeekSystem` | the RINEX record's system: "GPS", "GAL", "BDT", "QZS" or "IRN" |
| `utcString` | `string` | ISO 8601 instant string; a listed leap second is accepted |

## Returns

`{ week, timeOfWeekSeconds }`, or null on invalid input, before the system's epoch or past year 9999

## Types

### RinexWeek

A week and time of week as a RINEX navigation record counts them: continuous, so no era.

```ts
import type { RinexWeek } from "@northguild/gmt";
```

| Member | Type | Description |
| --- | --- | --- |
| `week` | `number` | The continuous week number, counted from the record's epoch without wrapping. |
| `timeOfWeekSeconds` | `number` | Seconds since the start of the week, from 0 up to but not including 604 800. |

## Related types

- [`RinexWeekSystem`](/gmt/reference/types/RinexWeekSystem/)

## Examples

```ts
import { utcToRinexWeek } from "@northguild/gmt/gnss/convert";

utcToRinexWeek("IRN", "2024-01-01T00:00:00Z") // { week: 2295, timeOfWeekSeconds: 86418 }
```

## Source

[gnss/convert/utcToRinexWeek.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/gnss/convert/utcToRinexWeek.ts)
