July 02, 2015 Best way to convert datetime betwen Python and D | ||||
---|---|---|---|---|
| ||||
Hi. What's the best way to convert a D std.datetime DateTime to a Python datetime.datetime and back again ? PyD allows for custom conversion methods in D, but that is not much use if I don't know how to make the conversion on the D side. I could obviously split out into y,m,d,h,m,s again, but I would rather not as these are fields in an array of structs that I would like to be able to do things easily with in Python. Calling an embedded Python interpreter to create a datetime pyd object and sending that back over does work, but it's hardly ideal... Laeeth. |
Copyright © 1999-2021 by the D Language Foundation