Skip to content

Unable to parse millisecond unix timestampsΒ #560

@jszwedko

Description

@jszwedko

Hey all,

I might be missing something, but I'm not seeing a way to use parse_from_str with unix timestamps that include milliseconds.

I would have expected something like:

fn main() {
    use chrono::TimeZone;
    let dt = chrono::offset::Utc.datetime_from_str("1620309579123", "%s%3f");
    println!("{:?}", dt);
}

to work, but it gives:

Err(ParseError(TooShort))

Is this possible or could it be added? I could try taking a shot at a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions