# Time API

Sync with server time, format timestamps with localized options, and compute future times without relying on client clocks.

## Quick Start

```typescript
import RundotGameAPI from '@series-inc/rundot-game-sdk/api'

const serverTime = await RundotGameAPI.time.requestTimeAsync()
console.log(serverTime.serverTime, serverTime.timezoneOffset)
```

## Formatting Helpers

```typescript
const formatted = RundotGameAPI.time.formatTime(Date.now(), {
  dateStyle: 'full',
  timeStyle: 'medium',
  hour12: true,
})

const formattedNumber = RundotGameAPI.time.formatNumber(1234567.89, {
  style: 'currency',
  currency: 'USD',
  minimumFractionDigits: 2,
  maximumFractionDigits: 2,
})
```

## Future Calculations

```typescript
const futureTime = await RundotGameAPI.time.getFutureTimeAsync({
  days: 1,
  hours: 2,
  minutes: 30,
})
```

## Best Practices

* Use server time for cooldowns or limited-time offers to avoid client clock tampering.
* Cache the server response and update periodically rather than spamming the endpoint.
* When formatting numbers, remember the host automatically applies the player’s locale.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://series-1.gitbook.io/rundot-docs/v5.15.0/readme/time.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
