pub fn strftime(value: impl Display, format: &str) -> StringExpand description
Formats a time in UTC with strftime directives: %b %-d, %Y gives Sep 29, 2026.
Directives: %Y (2026), %y (26), %m (09), %d (29), %e (day
padded with a space), %H (14), %I (02), %M, %S, %p (AM/PM),
%b (Sep), %B (September), %a (Tue), %A (Tuesday), %j (day of
the year), %F (2026-09-29), %T (14:05:00), %z (+0000: always
UTC), %%; %-d, %-m, %-H, %-I drop the zero padding. Unknown
directives are copied as they are. For month and day names in another
language, see I18n::l.
ยงExamples
use ocre::helpers::strftime;
assert_eq!(strftime("2026-09-29 14:05:00", "%A %-d %B %Y, %I:%M %p"), "Tuesday 29 September 2026, 02:05 PM");