# parseGtfsTime

Industry: Rail

:::caution[Unreleased]
Not in `@northguild/gmt` 1.21.0 on npm yet. It is on `main` and ships in the next release.
:::

## Signature

```ts
parseGtfsTime(value: string): GtfsTime | null
```

Reads a GTFS Schedule `Time` value, keeping the days past the service day apart from the time of day.

- Reads `HH:MM:SS`, `H:MM:SS` and `HHH:MM:SS`, hours up to 999; minutes and seconds `00` to `59`.
- `25:35:00` is 1:35 on the following day, still on the service day: `dayOverflow` counts the whole 24-hour blocks and `seconds` is what is left: the written time less those blocks.
- Nothing is trimmed: a space, tab, newline or byte order mark returns `null`.
- Reads the `Time` type only, not GTFS `Local time` (`timeframes.txt`).
- Resolves no local time and needs no zone; that is the job of the service date and the agency's zone. Source: GTFS Schedule Reference § Field Types, Time.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `string` | A GTFS `Time` field, such as `stop_times.txt` `arrival_time`. |

## Returns

The written time less whole 24-hour blocks (`seconds`) and those blocks (`dayOverflow`), or `null` on invalid input (an empty field included)

## Related types

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

## Examples

```ts
import { parseGtfsTime } from "@northguild/gmt/rail/parse";

parseGtfsTime("25:35:00") // { seconds: 5700, dayOverflow: 1 }
```

## Source

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