Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

local time format error: rfc822 #64

Closed
steveklabnik opened this issue Jan 27, 2015 · 2 comments
Closed

local time format error: rfc822 #64

steveklabnik opened this issue Jan 27, 2015 · 2 comments
Labels
C-duplicate Category: exact duplicate

Comments

@steveklabnik
Copy link

Issue by zengsai
Friday Aug 29, 2014 at 08:08 GMT

For earlier discussion, see rust-lang/rust#16841

This issue was labelled with: in the Rust repository


Source Code:

extern crate time;

fn main() {
    let utc = time::now_utc();
    let local = time::now();

    println!("utc:   {}", utc.rfc822());
    println!("local: {}", local.rfc822());
}

Console Output:

utc:   Fri, 29 Aug 2014 08:05:12 GMT
local: Fri, 29 Aug 2014 16:05:12 strftime: can't understand this format Z

According to the document of this API, the correct output should be:

utc:   Fri, 29 Aug 2014 08:05:12 GMT
local: Fri, 29 Aug 2014 16:05:12 PST
@jhpratt
Copy link
Member

jhpratt commented Oct 4, 2019

Closing as duplicate of #37.

@jhpratt jhpratt closed this as completed Oct 4, 2019
@jhpratt jhpratt added the C-duplicate Category: exact duplicate label Oct 4, 2019
@correabuscar
Copy link

Since it took me a while to find this, I'd like to mention it here:
in time version 0.1.44 you could do

time::now().to_utc().rfc822()

and print that, now in time version 0.3.20 you can do it like

time::OffsetDateTime::now_utc().format(&time::format_description::well_known::Rfc2822).unwrap()

and print it.

Cargo.toml:

time = { version="0.3", features= ["formatting","parsing"] }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-duplicate Category: exact duplicate
Projects
None yet
Development

No branches or pull requests

3 participants