[wxPython-users] wx.DateTime <> python datetime

Raffaello Barella barbarossa.platz at gmail.com
Sun Jan 13 12:37:31 PST 2008


def Cvt_wxDateTime_To_date( mwxDateTime):
    #CConverts a value wx.DateTime into a datetime.date
    return datetime.date(int(mwxDateTime.GetYear()), \
        int(mwxDateTime.GetMonth() + 1), int(mwxDateTime.GetDay()))

In fact, wx.DateTime months goes from 0 to 11.



2008/1/13, Mark Erbaugh <mark at microenh.com>:
>
> The wx.DatePickerCtrl returns a wx.DateTime value and doesn't appear to
> have a PyGetDate method (or did I miss that). Is there a simple way to
> get a python datetime from a wx.DateTime, other than brute force:
>
> d =3D datetime(wx.DateTime.Year (wx.DateTime.Month + 1) % 12,
> wx.DateTime.Day)
>
>
> (wx.DateTime months appear to go from 0 .. 11)
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200801=
13/58c1f260/attachment.htm


More information about the wxpython-users mailing list