Skip to content

How to directly invoke datetime type caster? #394

Answered by wjakob
WillAyd asked this question in Q&A
Discussion options

You must be logged in to vote

You would use the types from <chrono> on the C++ side and then let the type caster convert them into their Python analogs at the C++<->Python transition. There currently isn't a wrapper class for datetime objects, you are welcome to propose one in a PR.

Did you see this part of the documentation? -> https://nanobind.readthedocs.io/en/latest/api_extra.html#timestamp-and-duration-conversions

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@WillAyd
Comment options

Answer selected by WillAyd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants