question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement remaining datetime methods

See original GitHub issue

We need to implement toordinal() and fromordinal() along with the new timestamp() method.

Also our isoformat() method should be updated to include the timespec arg.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
krisfremencommented, Nov 13, 2020

Or does that not work? Can you share a bit more on what you mean “when you say this (integrating with arrow.get()) would conflict with unix timestamps”?

Technically, 737741 is a valid unix timestamp, I believe @systemcatch was referring to the fact it would create ambiguity in parsing ordinals vs UNIX timestamps.

>>> datetime.fromtimestamp(737741)
datetime.datetime(1970, 1, 9, 7, 55, 41)
>>> datetime.fromordinal(737741)
datetime.datetime(2020, 11, 12, 0, 0)
1reaction
jadchaarcommented, Nov 24, 2020

We should also make sure we support the timespec argument for isoformat(): https://docs.python.org/3/library/datetime.html#datetime.datetime.isoformat.

Edit: oops did not notice this was already mentioned in our original issue 😃.

Read more comments on GitHub >

github_iconTop Results From Across the Web

datetime — Basic date and time types — Python 3.11.1 ...
The datetime module supplies classes for manipulating dates and times. While date and time arithmetic is supported, the focus of the implementation is...
Read more >
How to find remaining time using JavaScript? - Stack Overflow
1 Answer 1 ... You can use setInterval and clearInterval functions for this purpose. You would have to create a function to do...
Read more >
Using Python datetime to Work With Dates and Times
In this section, you'll use relativedelta to calculate the time remaining until PyCon, develop a function to print the time remaining in a...
Read more >
Demystifying DateTime Manipulation in JavaScript - Toptal
Try to avoid creating a date from a string unless it is in ISO date format. Use the Date(year, month, date, hours, minutes,...
Read more >
DateTime Struct (System) - Microsoft Learn
Use the default date time format; Format a date and time using a specific culture; Format a ... and the remaining three dates...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found