diff --git a/readme.md b/readme.md index ecdfe5870..35afb90e2 100644 --- a/readme.md +++ b/readme.md @@ -38,6 +38,7 @@ Humanizer meets all your .NET needs for manipulating and displaying strings, enu - [Number to Numbers](#number-to-numbers) - [Number to words](#number-to-words) - [Number to ordinal words](#number-to-ordinal-words) + - [Date to words](#date-to-words) - [DateTime to ordinal words](#date-time-to-ordinal-words) - [TimeOnly to Clock Notation](#time-only-to-clock-notation) - [Roman numerals](#roman-numerals) @@ -884,6 +885,23 @@ Passing `wordForm` argument in when it is not applicable will not make any diffe 43.ToOrdinalWords(GrammaticalGender.Masculine, WordForm.Abbreviation, new CultureInfo("en")) => "forty-third" ``` +### Date to words +This is kind of an extension of ToWords and Ordinalize +```C# +// for Spanish locale +new DateTime(2022, 1, 1).ToOrdinalWords() => "uno de enero de dos mil veintidós" +new DateOnly(2020, 6, 10).ToOrdinalWords() => "diez de junio de dos mil veinte" +new DateOnly(1999, 12, 31).ToOrdinalWords() => "treinta y uno de diciembre de mil novecientos noventa y nueve" +// for English UK locale +new DateTime(2022, 1, 1).ToOrdinalWords() => "the first of January two thousand and twenty-two" +// for English US locale +new DateTime(2022, 1, 1).ToOrdinalWords() => "January first, two thousand and twenty-two" +``` + +The ToWords method of `DateTime` or `DateOnly` also supports grammatical case. +You can pass a second argument to `ToWords` to specify the case of the output. +The possible values are `GrammaticalCase.Nominative`, `GrammaticalCase.Genitive`, `GrammaticalCase.Dative`, `GrammaticalCase.Accusative`, `GrammaticalCase.Instrumental` and `GrammaticalGender.Prepositional` + ### DateTime to ordinal words This is kind of an extension of Ordinalize ```C#