> ## Content Index
> Fetch the complete content index at: https://reactpractice.dev/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to format a date as minutes in Javascript
- URL: https://reactpractice.dev/articles/how-to-format-a-date-as-minutes-in-javascript/
- Published: 2024-11-06T09:22:19.000Z
- Updated: 2026-06-01T01:59:16.000Z
- Author: Corina Udrescu
- Tags: Articles, #corina-2, Working with dates, #Import 2026-06-09 12:07

Say we have a `Date` object representing five minutes:

```js
const fiveMinutes = new Date(0, 0, 0, 0, 5, 0);
```

How can you format this date to display "5:00"?

The easiest way is using `Intl.DateTimeFormat` browser API (see [docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global%5FObjects/Intl/DateTimeFormat?ref=reactpractice.dev)). This formats the Date as a string, according to a given locale. By passing in the options to only include the `minutes` and `seconds`, we can obtain our date:

```js
const formattedDate = Intl.DateTimeFormat("en-US", {
    minute: "numeric",
    second: "numeric",
  }).format(fiveMinutes);
```

### Alternative 1: Date.toLocaleTimeString

Another good option to format the date as time is using `Date.toLocaleTimeString` ([docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global%5FObjects/Date/toLocaleTimeString?ref=reactpractice.dev)). This is equivalent with the option above.

```js
// show full time part
fiveMinutes.toLocaleTimeString();
// show just minutes and seconds
fiveMinutes.toLocaleTimeString(undefined, { minute: "numeric", second: "numeric"})
```

### Alternative 2: Concatenating time parts

Another approach is to extract the parts of the time using `Date.getMinutes` and `Date.getSeconds` methods and then concatenating them:

```
const minutes = fiveMinutes.getMinutes();
const seconds = fiveMinutes.getSeconds();
const paddedSeconds = seconds.toString().padStart(2, "0");
const formattedDate = `${minutes}:${paddedSeconds}`;
```

The downside of this approach is that it does not take the user locale into account and is error prone - since we are manually stiching things together.

For a broader discussion of formatting options, take a look at [https://www.freecodecamp.org/news/how-to-format-dates-in-javascript](https://www.freecodecamp.org/news/how-to-format-dates-in-javascript?ref=reactpractice.dev).

How do you format dates as time? Share your thoughts in the comments below!