Literally the inverse of this question, is there an easy way to get a .Net DateTime
from an IronPython datetime
?
Clearly, one could
- Output a string and parse it or
- Dump all the date parts into a
DateTime
constructor
but those are both messy. This doesn't work either:
pydate = datetime.datetime.now()
csharp = DateTime(pydate) # Crashes, because .Net wants a 'long' for Ticks
Is there an easy cast or a short way to get the Ticks
that .Net wants?