# parseWeekFromUtc

Industry: Core

## Signature

```ts
parseWeekFromUtc(value: string, optionsArg?: { weekStartsOn?: "monday" | "sunday"; timeZone?: string; }): number | null
```

Return the week number from a UTC datetime string.

- The result is the week of the week-year, 1–53, so late-December days can be week 1 of the next year: 2024-12-31 → 1 under either numbering, and 2000-12-30 → 53 under the Sunday-first one (minimal days 1).
- Returns null for invalid input.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `string` | ISO UTC datetime string (e.g., "2024-03-17T14:30:45Z") |

## Options

**optionsArg**

How weeks are numbered, and the time zone the value is read in

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `weekStartsOn?` | `"monday"` \| `"sunday"` | `"monday"` | The first day of the week, which sets how the week is numbered. `"monday"` gives the ISO 8601 week number, where week 1 holds the year's first Thursday; `"sunday"` gives the UTS #35 week number with a Sunday first day and one minimal day, where week 1 holds 1 January. Any other value returns `null`. |
| `timeZone?` | `string` | `"UTC"` | The time zone the wall-clock fields are read in: an IANA name, a UTC offset (a time zone identifier such as `+05:30`, `+0530` or `-08`, or a stored offset `±HH:MM[:SS]`, what `getTimeZoneOffset` returns), or `"local"` for the system time zone. An unknown zone returns `null`. |

## Returns

Week number (1-53), or null on invalid input

## Examples

```ts
import { parseWeekFromUtc } from "@northguild/gmt/utc/parse";

parseWeekFromUtc("2024-03-17T14:30:45Z") // 11
```

## Source

[utc/parse/parseWeekFromUtc.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/utc/parse/parseWeekFromUtc.ts)
