[C++-sig] Creating non-naive datetime objects in C++

Grant Mckenzie mckenzig at optonline.net
Fri Oct 22 06:07:03 CEST 2010


Hi,

I am writing some C++ code and importing into python via swig. I'd like to pass datetime objects to pass back to python. The following code will create a naive datetime after including datetime.h.

PyObject* ret = PyDateTimeAPI->DateTime_FromDateAndTime( y, m, d, h, m, s, u, Py_None, PyDateTimeAPI->DateTimeType);

I'd like to create a datetime object with UTC timezone info set. Much to my chagrin, I am having lots of trouble finding an example of how to do this. Any help would be appreciated.

Regards,
Grant.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20101022/750aa631/attachment.html>


More information about the Cplusplus-sig mailing list