How can I print a date/time without leading zeros? For example, Jul 5, 9:15
.
According to the docs it uses the same syntax as strftime
, however suppressing leading zeros
time::strftime("%b %-d, %-I:%M", &time::now()).unwrap()
leads to an error:
thread '' panicked at 'called
Result::unwrap()
on anErr
value: InvalidFormatSpecifier('-')', ../src/libcore/result.rs:746
I suspect Rust doesn't support the glibc extensions that provide this flag (and several others); however there is no syntax for non-prefixed date/time; the alternative (%l
) just prefixes with blank space which is equally useless.
I could create the string by hand, but that defeats the purpose of the function.