-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
datetime64("now") is undocumented #10003
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
Comments
See here for the underlying C-function: numpy/numpy/core/src/multiarray/datetime_strings.c Lines 189 to 219 in 6582813
Note that it also supports the string "today" indicating a local time. If we're going to document it, we should probably make sure that the functionality makes sense. In the most recent version of datetime64, we aim for compatibility with Python's datetime module (without timezones). So it's a little strange that "now" means UTC rather than local time (see https://docs.python.org/2/library/datetime.html#datetime.datetime.now) Arguably, we should use something different like "utcnow" for UTC. The precision issue could potentially be improved, possibly by switching to rely on Python's |
Would like to work on this as my first contribution, is it open ? |
As noted above, I think we should probably clean up this functionality before documenting it, which would encourage more people to rely on functionality that would likely change. |
Yeah the precision thing is quite misleading I think, passing |
I have raised an PR to add the example of |
I found out that you can get the current UTC date with
np.datetime64("now")
.However this isn't documented here and there are a few things about the behaviour that aren't obvious. For instance it seems that the precision cannot be greater than one second:
The text was updated successfully, but these errors were encountered: