# Date input (UI SDK): Date and time

> `granularity` set to `"hour"`, `"minute"` or `"second"` adds the time, and the value becomes a local date and time like `"2026-11-02T14:30"`.

Canonical: https://hextaui.com/docs/ui-sdk-date-input/examples/date-time

Component docs: https://hextaui.com/docs/ui-sdk-date-input

## Add this example

```bash
npx shadcn@latest add https://hextaui.com/r/ui-sdk-date-input-date-time.json
```

This adds `components/examples/ui-sdk-date-input/date-time.tsx` with the Date input component and the HextaUI theme tokens.

## Source

```tsx title="components/examples/ui-sdk-date-input/date-time.tsx"
import { Label } from "@/components/ui/label"
import { DateInput } from "@/components/ui/ui-sdk-date-input"

function UiSdkDateInputDateTime() {
  return (
    <div className="flex w-full max-w-60 flex-col gap-2">
      <Label id="departure">Departure</Label>
      <DateInput
        aria-labelledby="departure"
        granularity="minute"
        defaultValue="2026-11-02T14:30"
        locale="en-US"
      />
    </div>
  )
}

export { UiSdkDateInputDateTime }
```

## Props in this example

### DateInput

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `defaultValue` | `string \| null` | – |  |
| `granularity` | `"day" \| "hour" \| "minute" \| "second"` | `"day"` |  |
| `locale` | `string` | – | Defaults to the page’s language. |

## More Date input examples

- [Min and max](https://hextaui.com/docs/ui-sdk-date-input/examples/min-max)
- [Unavailable dates](https://hextaui.com/docs/ui-sdk-date-input/examples/unavailable)
- [Locale](https://hextaui.com/docs/ui-sdk-date-input/examples/locale)
- [Form](https://hextaui.com/docs/ui-sdk-date-input/examples/form)
- [Controller](https://hextaui.com/docs/ui-sdk-date-input/examples/controller)
- [Disabled](https://hextaui.com/docs/ui-sdk-date-input/examples/disabled)
- [Read-only](https://hextaui.com/docs/ui-sdk-date-input/examples/read-only)
- [Right to left](https://hextaui.com/docs/ui-sdk-date-input/examples/rtl)
