Skip to main content
Version: 4.0 (next)

Developer quick start

Create a console app, install Humanizer, and produce one deterministic duration. You need a .NET 8 or newer SDK.

Create and run

Create the project and install Humanizer 4:

dotnet new console --name HumanizerQuickStart
cd HumanizerQuickStart
dotnet add package Humanizer --version 4.0.0

Replace Program.cs with the verified source:

Program.cs
using System.Globalization;
using Humanizer;

CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("en-US");
CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo("en-US");

var result = TimeSpan.FromMinutes(2).Humanize();

Console.WriteLine(result);

Run it:

dotnet run

Result

The program prints exactly:

2 minutes

Many Humanizer operations use the current culture or UI culture when no culture is supplied. Set both explicitly in tests, background work, and any operation whose output must be predictable.