# formatGtfsTime

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
formatGtfsTime(value: GtfsTime): string
```

Writes a GTFS Schedule `Time` value, keeping the days past the service day in the hour.

- Writes `HH:MM:SS` with at least two hour digits: `08:05:00`, not `8:05:00`; `110:29:00`.
- `dayOverflow` adds 24 hours a day, so `{ seconds: 5700, dayOverflow: 1 }` is `25:35:00`, never `01:35:00`.
- A value over `999:59:59` cannot be written in three digits and returns `""`.
- The argument is read like a property bag: any object, a function included; each member is read once, inherited members are read and extra members are ignored. Source: GTFS Schedule Reference § Field Types, Time.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `GtfsTime` | The written time less whole 24-hour blocks (`seconds`, 0–86399) and the whole days past the service day (`dayOverflow`, 0 or more). |

## Returns

The GTFS `Time` string, or `""` on invalid input (not a `GtfsTime`, or past `999:59:59`)

## Related types

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

## Examples

```ts
import { formatGtfsTime } from "@northguild/gmt/rail/format";

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

## Source

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