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

Make date/time format conform to ISO8601 #1

Open
danzek opened this issue Aug 5, 2018 · 0 comments
Open

Make date/time format conform to ISO8601 #1

danzek opened this issue Aug 5, 2018 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@danzek
Copy link
Owner

danzek commented Aug 5, 2018

I currently don't zero-pad dates/times to conform to ISO8601 format for dates/times which causes problems when I sort by date. Currently I use some sed-fu to work around this by fixing the dates like so:

$ cat output.csv | sed -r 's/([0-9]{4})\-([0-9])\-([0-9])/\1-0\2-\3/' |  sed -r 's/([0-9]{4})\-([0-9]{2})\-([0-9]),/\1-\2-0\3,/' > output_fixed_dates.csv

Then I fix the times like so:

$ cat output_fixed_dates.csv | sed -r 's/,([0-9])(:[0-9]{1,2}:[0-9]{1,2}),/,0\1\2,/' | sed -r 's/,([0-9]{2}:)([0-9]:)([0-9]{1,2}),/,\10\2\3,/' | sed -r 's/,([0-9]{2}:)([0-9]{2}:)([0-9]),/,\1\20\3,/' > output_fixed_dates_and_times.csv

You could certainly do it all in one command but I like iterative error checking / validation.

But this is trivial to fix in the code so I should do that rather than having to resort to such sed-fu.

@danzek danzek added the enhancement New feature or request label Aug 5, 2018
@danzek danzek self-assigned this Aug 5, 2018
@danzek danzek changed the title Make date format conform to ISO8601 Make date/time format conform to ISO8601 Aug 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant