-
Notifications
You must be signed in to change notification settings - Fork 306
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
Add recipes #8
Comments
@techtonik I think this is a good idea, but I'm having a hard time thinking of good examples.
What format is that? How would you picture this being displayed? Re: ISO 8601 formatting, is there something missing from |
Yes, string returned by datetime.isoformat() is not fixed length. If microseconds are 0, it returns 2014-08-27 01:00:00 |
Another possible example I recently came across on my own that might be useful: Parsing the date strings returned by the Twitter API: >>> datetime.datetime.strptime('Wed Jun 06 20:07:10 +0000 2012', '%a %b %d %H:%M:%S +0000 %Y')
datetime.datetime(2012, 6, 6, 20, 7, 10) |
@mccutchen having trouble coming up with examples ? Take a look at |
Rather than dump a bunch of examples, you could use JS to make a demo. It would just take 1 text field for the format string and an element in which to place the result. Make the codes clickable so that someone can come to the page, click a bunch of codes in the order they want, copy, and go. You'd want to put a delimiter (like a space) after each clicked code and allow the user to either edit or remove to get their preference. |
@RichardBronosky can you demonstrate what are you speaking about? Is it some kind of interactive Jupyter notebook? |
I made a tool that attempts to guess the format you need based on a datetime string: https://pym.dev/strptime That page also includes a list of common formats to pick from (direct link to that here). I've been a happy user of https://strftime.org for years but I was wanting something that's a bit more opinionated about the full format string. I linked to https://strftime.org and https://www.strfti.me (which I discovered from strftime.org) on that page because I still find these simple format code cheat sheets very useful, especially when working with odd datetime formats. |
There are many gotchas with formatting time, getting right time/date/datetime object, and choosing right syntax for popular formats. It would help to have a preformatted copy-pasteable snippets. I'd personally need 2014-08-27 01:00:00.00000 in UTC, but other formats, such as full ISO 8601 format are useful too.
The text was updated successfully, but these errors were encountered: