> ## Documentation Index
> Fetch the complete documentation index at: https://sunpeak.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# useTimeZone

> Get the user's time zone.

<Badge color="yellow">sunpeak API</Badge>

## Overview

The `useTimeZone` hook returns the user's time zone from the host. It is a convenience wrapper around `useHostContext`.

<Card horizontal title="Wraps onhostcontextchanged" icon="cube" href="/mcp-apps/app/event-handlers/onhostcontextchanged">
  MCP Apps SDK reference
</Card>

## Import

```tsx theme={null}
import { useTimeZone } from 'sunpeak';
```

## Signature

```tsx theme={null}
function useTimeZone(): string
```

## Returns

<ResponseField name="return" type="string">
  IANA time zone string (e.g., `'America/New_York'`). Falls back to the browser's local time zone when the host does not report one.
</ResponseField>

## Usage

```tsx theme={null}
import { useTimeZone } from 'sunpeak';

function MyResource() {
  const timeZone = useTimeZone();

  const time = new Date().toLocaleTimeString('en-US', { timeZone });
  return <p>Current time: {time}</p>;
}
```

The time zone value comes from [`McpUiHostContext.timeZone`](/mcp-apps/types/core-types#mcpuihostcontext).
