Skip to content

How do I get a month name like Jan or January from a date? #392

Answered by BurntSushi
tch1121 asked this question in Q&A
Discussion options

You must be logged in to vote

A method like this is specifically not available because it is quite sensitive to locale. And, for the most part, Jiff specifically opts out of doing anything with locale. Instead, that's left to crates like icu to handle. Jiff specifically offers integration with icu via jiff-icu. The crate docs have examples for how to localize dates. As I understand it (and I could be wrong, icu's API is vast), there is no simple method to get the month name.

With all that said, there are two corners of Jiff that specifically eschew localization. One is its "friendly" duration format. The other is the jiff::fmt::strtime APIs. The strtime APIs are meant to provide a simplistic means for ad hoc formattin…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by BurntSushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #391 on July 15, 2025 11:59.