---
title: "django.contrib.humanize"
version: 1.10
locale: id
source: https://docs.djangoproject.com/id/1.10/ref/contrib/humanize/
canonical: https://djangodocs.dev/id/1.10/ref/contrib/humanize/
---
# `django.contrib.humanize`

A set of Django template filters useful for adding a "human touch" to data.

To activate these filters, add `'django.contrib.humanize'` to your
[`INSTALLED_APPS`](/id/1.10/ref/settings/#std-setting-INSTALLED_APPS) setting. Once you've done that, use
`{% load humanize %}` in a template, and you'll have access to the following
filters.

## `apnumber`

For numbers 1-9, returns the number spelled out. Otherwise, returns the
number. This follows Associated Press style.

Contoh:

- `1` menjadi `satu`.
- `2` menjadi `dua`.
- `10` menjadi `10`.

Anda dapat melewati di salah satu integer atau string perwakilan dari integer.

## `intcomma`

Converts an integer or float (or a string representation of either) to a string
containing commas every three digits.

Contoh:

- `4500` menjadi `4,500`.
- `4500.2` menjadi `4,500.2`.
- `45000` menjadi `45,000`.
- `450000` menjadi `450,000`.
- `4500000` menjadi `4,500,000`.

[Format localization](/id/1.10/topics/i18n/formatting/) akan dihormati jika diadakan, sebagai contoh dengan bahasa `'de'`:

- `45000` menjadi `'45.000'`.
- `450000` menjadi `'450.000'`.

## `intword`

Converts a large integer (or a string representation of an integer) to a
friendly text representation. Works best for numbers over 1 million.

Contoh:

- `1000000` menjadi `1.0 juta`.
- `1200000` menjadi `1.2 juta`.
- `1200000000` menjadi `1.2 trilyun`.

Nilai sampai 10^100 (Googol) yang didukung.

[Format localization](/id/1.10/topics/i18n/formatting/) akan dihormati jika diadakan, sebagai contoh dengan bahasa `'de'`:

- `1000000` menjadi `'1,0 Juta'`.
- `1200000` menjadi `'1,2 Juta'`.
- `1200000000` menjadi `'1,2 Milliarden'`.

## `naturalday`

For dates that are the current day or within one day, return "today",
"tomorrow" or "yesterday", as appropriate. Otherwise, format the date using
the passed in format string.

**Argumen:** String pembentukan tanggal seperti digambarkan di etiket [`date`](/id/1.10/ref/templates/builtins/#std-templatefilter-date)

Contoh (ketika 'hari ini' adalah 17 Feb 2007):

- 16 Feb 2007\` menjadi `kemarin`.
- 17 Feb 2007\` menjadi `hari ini`.
- 18 Feb 2007\` menjadi `besok`.
- Any other day is formatted according to given argument or the
  [`DATE_FORMAT`](/id/1.10/ref/settings/#std-setting-DATE_FORMAT) setting if no argument is given.

## `naturaltime`

For datetime values, returns a string representing how many seconds,
minutes or hours ago it was -- falling back to the [`timesince`](/id/1.10/ref/templates/builtins/#std-templatefilter-timesince)
format if the value is more than a day old. In case the datetime value is in
the future the return value will automatically use an appropriate phrase.

Contoh (ketika 'sekarang' adalah 17 Feb 2007 16:30:00):

- `17 Feb 2007 16:30:00` menjadi `sekarang`.
- `17 Feb 2007 16:29:31` menjadi `29 menit lalu`.
- `17 Feb 2007 16:29:00` menjadi semenit lalu\`.
- `17 Feb 2007 16:25:35` menjadi `4 menit lalu`.
- `17 Feb 2007 15:30:29` menjadi `59 menit lalu`.
- `17 Feb 2007 15:30:01` menjadi `59 menit lalu`.
- `17 Feb 2007 15:30:00` menjadi `satu jam lalu`.
- `17 Feb 2007 13:31:29` becomes `2 jam lalu`.
- `16 Feb 2007 13:31:29` menjadi\`\` 1 hari, 2 jam lalu\`\`.
- `16 Feb 2007 13:30:01` menjadi `1 hari, 2 jam lalu`.
- `16 Feb 2007 13:30:00` menjadi `1 hari, 3 jam lalu`.
- `17 Feb 2007 16:30:30` menjadi `30 detik dari sekarang`.
- `17 Feb 2007 16:30:29` menjadi `29 detik dari sekarang`.
- `17 Feb 2007 16:31:00` menjadi satu menit dari sekarang\`.
- `17 Feb 2007 16:34:35` menjadi `4 menit dari sekarang`.
- `17 Feb 2007 17:30:29` menjadi `satu jam dari sekarang`.
- `17 Feb 2007 18:31:29` menjadi `2 jam dari sekarang`.
- `18 Feb 2007 16:31:29` menjadi `1 hari dari sekarang`.
- `26 Feb 2007 18:31:29` menjadi `1 minggu, 2 hari dari sekarang`.

## `ordinal`

Merubah sebuah integer ke urutannya sebagai sebuah string

Contoh:

- `1` menjadi `1st`.
- `2` menjadi `2nd`.
- `3` menjadi `3rd`.

Anda dapat melewati di salah satu integer atau string perwakilan dari integer.
