Skip to content

Commit 6e0aa69

Browse files
committed
Update readme with date to words
Changed the readme to add date-to-words documentation.
1 parent 7fd79ad commit 6e0aa69

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

readme.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Humanizer meets all your .NET needs for manipulating and displaying strings, enu
3838
- [Number to Numbers](#number-to-numbers)
3939
- [Number to words](#number-to-words)
4040
- [Number to ordinal words](#number-to-ordinal-words)
41+
- [Date to words](#date-to-words)
4142
- [DateTime to ordinal words](#date-time-to-ordinal-words)
4243
- [TimeOnly to Clock Notation](#time-only-to-clock-notation)
4344
- [Roman numerals](#roman-numerals)
@@ -884,6 +885,23 @@ Passing `wordForm` argument in when it is not applicable will not make any diffe
884885
43.ToOrdinalWords(GrammaticalGender.Masculine, WordForm.Abbreviation, new CultureInfo("en")) => "forty-third"
885886
```
886887

888+
### <a id="date-to-words">Date to words</a>
889+
This is kind of an extension of ToWords and Ordinalize
890+
```C#
891+
// for Spanish locale
892+
new DateTime(2022, 1, 1).ToOrdinalWords() => "uno de enero de dos mil veintidós"
893+
new DateOnly(2020, 6, 10).ToOrdinalWords() => "diez de junio de dos mil veinte"
894+
new DateOnly(1999, 12, 31).ToOrdinalWords() => "treinta y uno de diciembre de mil novecientos noventa y nueve"
895+
// for English UK locale
896+
new DateTime(2022, 1, 1).ToOrdinalWords() => "the first of January two thousand and twenty-two"
897+
// for English US locale
898+
new DateTime(2022, 1, 1).ToOrdinalWords() => "January first, two thousand and twenty-two"
899+
```
900+
901+
The ToWords method of `DateTime` or `DateOnly` also supports grammatical case.
902+
You can pass a second argument to `ToWords` to specify the case of the output.
903+
The possible values are `GrammaticalCase.Nominative`, `GrammaticalCase.Genitive`, `GrammaticalCase.Dative`, `GrammaticalCase.Accusative`, `GrammaticalCase.Instrumental` and `GrammaticalGender.Prepositional`
904+
887905
### <a id="date-time-to-ordinal-words">DateTime to ordinal words</a>
888906
This is kind of an extension of Ordinalize
889907
```C#

0 commit comments

Comments
 (0)