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

Cast Timestamps to RFC3339 strings #2934

Closed
tustvold opened this issue Oct 26, 2022 · 3 comments · Fixed by #2939
Closed

Cast Timestamps to RFC3339 strings #2934

tustvold opened this issue Oct 26, 2022 · 3 comments · Fixed by #2939
Labels
api-change Changes to the arrow API arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog good first issue Good for newcomers help wanted

Comments

@tustvold
Copy link
Contributor

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

Currently timestamps are cast to the default chrono format, such as 2018-01-26 18:30:09.453829 +08:00. This is not a defined standard, it appears to be RFC3339 but using spaces.

Describe the solution you'd like

Cast timestamps to strings as RFC3339

Describe alternatives you've considered

We could not do this

Additional context

@tustvold tustvold added enhancement Any new improvement worthy of a entry in the changelog good first issue Good for newcomers api-change Changes to the arrow API help wanted labels Oct 26, 2022
@waitingkuo
Copy link
Contributor

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=42768115ab784d65df24ca371c09f985

the debug version follows RFC3339

use chrono; // 0.4.22
use chrono::{TimeZone, FixedOffset};

fn main() {
    let dt = FixedOffset::east(8 * 60 * 60).ymd(2018, 1, 26).and_hms_micro(18, 30, 9, 453_829);
    println!("{}", dt);
    println!("{:?}", dt);
}
2018-01-26 18:30:09.453829 +08:00
2018-01-26T18:30:09.453829+08:00

@waitingkuo
Copy link
Contributor

@jhorstmann
Copy link
Contributor

to_rfc3339_opts also allows specifying how many fractional digits and whether to use a Z instead of +00:00 for UTC.

@alamb alamb added the arrow Changes to the arrow crate label Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-change Changes to the arrow API arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog good first issue Good for newcomers help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants