How to print date / time without leading zeros? For example, Jul 5, 9:15 .
According to 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 '' panarked at 'called Result::unwrap() by value Err : InvalidFormatSpecifier (' - ')', .. / src / libcore / result.rs: 746
I suspect that Rust does not support the glibc extensions that provide this flag (and several others); however, there is no syntax for dates / times with a prefix; the alternative ( %l ) is just prefixes with empty space that is equally useless.
I could create the string manually, but this defeats the purpose of the function.
source share