useFormatDateTime

useFormatDateTime is a custom hook for formatting date time.

1/19/2026

Usage

import { useFormatDateTime } from "@yamada-ui/react"
const formattedValue = useFormatDateTime(new Date())

It formats date time according to the specified locale and options. The hook returns the formatted value directly.

Changing the Locale

To change the locale, set a value for locale.

en-US

1/19/2026

ja-JP

2026/1/19

de-DE

19.1.2026

fr-FR

19/01/2026

zh-CN

2026/1/19

Set the Locale for the Entire Application

If you want to set the locale for the entire application, set the locale for the UIProvider.

import { UIProvider } from "@yamada-ui/react"

const App = () => {
  return (
    <UIProvider locale="en-US">
      <YourComponent />
    </UIProvider>
  )
}

Converting to Year

To convert to year, set a value for year.

2026

Converting to Month

To convert to month, set a value for month.

January

Converting to Day

To convert to day, set a value for day.

19

Converting to Weekday

To convert to weekday, set a value for weekday.

Monday

2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd