# getNowUnit

Industry: Core

## Signature

```ts
getNowUnit(unit: NowUnit): string
```

Return the requested current unit value using the system timeZone.

- Valid units: "year", "month", "week", "day", "dayOfWeek", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond".
- Uses Temporal.Now.zonedDateTimeISO() to get current time in system timezone.
- `unit` accepts the singular or plural name of a Temporal unit (`"hour"` or `"hours"`), as Temporal does; `"dayOfWeek"` has no plural.
- Returns "" when unit is invalid or system timezone is unavailable.
- The `"year"` unit is written as Temporal writes a year: four digits (`"2024"`, `"0005"`), or a sign and six digits outside 0000–9999 (`"+010000"`, `"-000005"`).

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `unit` | `NowUnit` | unit to extract from current local time |

## Returns

string representation of the requested unit or "" on invalid

## Types

### NowUnit

Units extractable from the current system local time via `getNowUnit`. Defined as `DateTimeUnit | "dayOfWeek"`.

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

```ts
SmallestUnit<DateTimeUnit> | "dayOfWeek"
```

## Examples

```ts
import { getNowUnit } from "@northguild/gmt/plain/get";

getNowUnit("year") // "2024"
```

## Source

[plain/get/getNowUnit.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/plain/get/getNowUnit.ts)
