 <p>You can use the crate <a href="https://crates.io/crates/chrono" rel="nofollow"><code>chrono</code></a> to achieve the same result:</p> <pre><code>extern crate chrono; use chrono::Local; fn main() { let date = Local::now(); println!("{}", date.format("%Y-%m-%d][%H:%M:%S")); } </code></pre> <p><strong>Edit:</strong></p> <p>The time crate is not deprecated: it is unmaintained.</p> <p>Besides, it is not possible to format a time using only the standard library.</p>