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

# Dates and timezones

> Date and time formats used in Everhour API requests and responses, including timezone handling and duration encoding.

The Everhour API uses a small set of fixed string formats for all date and time values. None of these formats are ISO 8601 extended format, and Unix timestamps are not accepted or returned.

<Warning>
  Do not use ISO 8601 extended format or Unix timestamps — the API will reject or misparse the value.
</Warning>

## Accepted formats

| Format                | Field type                                                         | Example               |
| --------------------- | ------------------------------------------------------------------ | --------------------- |
| `YYYY-MM-DD`          | Date-only (`date`, `from`, `to`, expense `date`, assignment dates) | `2026-05-04`          |
| `YYYY-MM-DD HH:MM:SS` | Datetime (`createdAt`, `updatedAt`, screenshot timestamps)         | `2026-05-04 09:30:00` |
| `HH:MM`               | Time of day (timecard `startTime`, `endTime`, clock-in)            | `09:30`               |

## Request fields

Use `YYYY-MM-DD` for all date parameters such as `date`, `from`, and `to`. Use `YYYY-MM-DD HH:MM:SS` for datetime fields. Use `HH:MM` for time-of-day fields.

Date range parameters are **inclusive on both ends**. A request with `from=2026-05-01&to=2026-05-31` returns records for every day from May 1 through May 31 inclusive.

## Response fields

Datetime fields such as `createdAt` and `updatedAt` are returned as `YYYY-MM-DD HH:MM:SS` with no timezone suffix. Treat all such values as UTC.

Date-only fields are returned as `YYYY-MM-DD`.

## Timezones

The user object includes a `timezone` field that contains the user's UTC offset as a **float representing hours** — for example, `-5`, `5.5`, or `0`. Values are restricted to whole and half hours. This is not an IANA timezone name.

No timezone conversion is applied to datetime values in API responses. All datetimes are UTC-naive; apply the user's `timezone` offset locally if you need to display times in the user's local time.

## Time durations

The `time` field on time records and timer responses is an **integer in seconds**. To convert to hours, divide by `3600`.

```
3600   → 1 h
5400   → 1 h 30 m
90     → 1 m 30 s
```

## Money amounts

`amount` fields on expenses and invoices are **integers in the smallest currency unit** (cents for USD/EUR). For example, `1500` represents \$15.00. `quantity` fields are floats.

## Clearing a date field

Fields that accept the `DateTimeResettable` type treat an empty string `""` as a signal to clear the stored value rather than a parse error. This is the only way to unset such a field via the API.

## Code examples

The examples below build a request to `GET /team/time` with a date range, then convert the `time` integer in each record to hours.

<CodeGroup>
  ```bash Bash/cURL theme={null}
  curl -G "https://api.everhour.com/team/time" \
    -H "X-Api-Key: YOUR_API_KEY" \
    --data-urlencode "from=2026-05-01" \
    --data-urlencode "to=2026-05-31" \
  | jq '[.[] | {id: .id, hours: (.time / 3600)}]'
  ```

  ```ruby Ruby theme={null}
  require "net/http"
  require "json"
  require "uri"

  uri = URI("https://api.everhour.com/team/time")
  uri.query = URI.encode_www_form(from: "2026-05-01", to: "2026-05-31")

  req = Net::HTTP::Get.new(uri)
  req["X-Api-Key"] = "YOUR_API_KEY"

  response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
  records = JSON.parse(response.body)

  records.each do |record|
    hours = record["time"] / 3600.0
    puts "#{record["id"]}: #{hours} h"
  end
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.everhour.com/team/time",
      headers={"X-Api-Key": "YOUR_API_KEY"},
      params={"from": "2026-05-01", "to": "2026-05-31"},
  )
  response.raise_for_status()

  for record in response.json():
      hours = record["time"] / 3600
      print(f"{record['id']}: {hours:.2f} h")
  ```

  ```php PHP theme={null}
  <?php

  $query = http_build_query(["from" => "2026-05-01", "to" => "2026-05-31"]);
  $url   = "https://api.everhour.com/team/time?" . $query;

  $ctx = stream_context_create([
      "http" => [
          "header" => "X-Api-Key: YOUR_API_KEY\r\n",
      ],
  ]);

  $body    = file_get_contents($url, false, $ctx);
  $records = json_decode($body, true);

  foreach ($records as $record) {
      $hours = $record["time"] / 3600;
      printf("%s: %.2f h\n", $record["id"], $hours);
  }
  ```

  ```java Java theme={null}
  import java.net.URI;
  import java.net.http.*;
  import com.fasterxml.jackson.databind.*;

  HttpClient client = HttpClient.newHttpClient();

  HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create("https://api.everhour.com/team/time?from=2026-05-01&to=2026-05-31"))
      .header("X-Api-Key", "YOUR_API_KEY")
      .GET()
      .build();

  HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

  ObjectMapper mapper = new ObjectMapper();
  JsonNode records = mapper.readTree(response.body());

  for (JsonNode record : records) {
      double hours = record.get("time").asDouble() / 3600;
      System.out.printf("%s: %.2f h%n", record.get("id").asText(), hours);
  }
  ```

  ```javascript JavaScript theme={null}
  import fetch from "node-fetch";

  const params = new URLSearchParams({ from: "2026-05-01", to: "2026-05-31" });
  const response = await fetch(`https://api.everhour.com/team/time?${params}`, {
    headers: { "X-Api-Key": "YOUR_API_KEY" },
  });

  if (!response.ok) throw new Error(`HTTP ${response.status}`);

  const records = await response.json();
  for (const record of records) {
    const hours = record.time / 3600;
    console.log(`${record.id}: ${hours.toFixed(2)} h`);
  }
  ```

  ```go Go theme={null}
  package main

  import (
  	"encoding/json"
  	"fmt"
  	"net/http"
  	"net/url"
  )

  func main() {
  	params := url.Values{"from": {"2026-05-01"}, "to": {"2026-05-31"}}
  	req, _ := http.NewRequest("GET", "https://api.everhour.com/team/time?"+params.Encode(), nil)
  	req.Header.Set("X-Api-Key", "YOUR_API_KEY")

  	resp, err := http.DefaultClient.Do(req)
  	if err != nil {
  		panic(err)
  	}
  	defer resp.Body.Close()

  	var records []struct {
  		ID   string `json:"id"`
  		Time int    `json:"time"`
  	}
  	json.NewDecoder(resp.Body).Decode(&records)

  	for _, r := range records {
  		hours := float64(r.Time) / 3600
  		fmt.Printf("%s: %.2f h\n", r.ID, hours)
  	}
  }
  ```

  ```csharp .NET theme={null}
  using System.Net.Http;
  using System.Net.Http.Json;
  using System.Text.Json;

  var client = new HttpClient();
  client.DefaultRequestHeaders.Add("X-Api-Key", "YOUR_API_KEY");

  var url = "https://api.everhour.com/team/time?from=2026-05-01&to=2026-05-31";
  var records = await client.GetFromJsonAsync<JsonElement[]>(url)
      ?? Array.Empty<JsonElement>();

  foreach (var record in records)
  {
      double hours = record.GetProperty("time").GetDouble() / 3600;
      Console.WriteLine($"{record.GetProperty("id").GetString()}: {hours:F2} h");
  }
  ```
</CodeGroup>
