I need help on wx.DatePickerCtrl

Hi,

I use wx.DatePickerCtrl below is the code:

date = wx.GenericDatePickerCtrl(panel, size=(150,-1),
style = wx.TAB_TRAVERSAL
> wx.DP_DROPDOWN
> wx.DP_SHOWCENTURY
> wx.DP_ALLOWNONE )
self.Bind(wx.EVT_DATE_CHANGED, self.OnDateChanged, dbirthV)

When I print date I got this Thu 26 Aug 6427 17:32:29 WAT .
The 6427 is suppose to be 2012
How can I format or return the date in ISO YYYY-MM-DD?

Thanks,

Sunday Olutayo
Sadeeb Technologies Ltd
7 Mayegun Street, Ojo
Lagos State, Nigeria.

Tel: +234 1 7404524
D/L: +234 1 8169922
Cell: +234 8054600338, 234 8096441688
Fax: +234 8054895664
mail: olutayo@sadeeb.com

        ![sadeeb_icon_v4.png|50x52](upload://pRtE1tECEjI4lA6HQiIdUg2kIPR.png)

You need to show us more of your code, like how and where you are
fetching the date, and how you are printing it. I don’t see
anything like this.

···

SUNDAY A. OLUTAYO wrote:

Hi,

    I use wx.DatePickerCtrl below is the code:



    date = wx.GenericDatePickerCtrl(panel, size=(150,-1),

                                               style =

wx.TAB_TRAVERSAL

                                                   | wx.DP_DROPDOWN

                                                   |

wx.DP_SHOWCENTURY

                                                   | wx.DP_ALLOWNONE

)

    self.Bind(wx.EVT_DATE_CHANGED, self.OnDateChanged, dbirthV)



    When I print date I got this Thu 26 Aug 6427
    17:32:29 WAT .

    The 6427
    is suppose to be 2012

    How can I format or return the date in ISO YYYY-MM-DD?
-- Tim Roberts, Providenza & Boekelheide, Inc.

timr@probo.com

This is the complete code:

date = wx.GenericDatePickerCtrl(panel, size=(150,-1),

                                               style =

wx.TAB_TRAVERSAL

                                                   > wx.DP_DROPDOWN

                                                   >

wx.DP_SHOWCENTURY

                                                   > wx.DP_ALLOWNONE

)

    self.Bind(wx.EVT_DATE_CHANGED, self.OnDateChanged, date)

def OnDateChanged(self, evt):
global date
date = evt.GetDate()

def OnSave(self, evt):
print date
self.Close()

Thanks,

Sunday Olutayo

···

SUNDAY A. OLUTAYO wrote:

Hi,

    I use wx.DatePickerCtrl below is the code:



    date = wx.GenericDatePickerCtrl(panel, size=(150,-1),

                                               style =

wx.TAB_TRAVERSAL

                                                   | wx.DP_DROPDOWN

                                                   |

wx.DP_SHOWCENTURY

                                                   | wx.DP_ALLOWNONE

)

    self.Bind(wx.EVT_DATE_CHANGED, self.OnDateChanged, dbirthV)



    When I print date I got this Thu 26 Aug 6427
    17:32:29 WAT .

    The 6427
    is suppose to be 2012

    How can I format or return the date in ISO YYYY-MM-DD?
--
Tim Roberts, Providenza & Boekelheide, Inc.

timr@probo.com

http://groups.google.com/group/wxPython-users?hl=en

Well, that’s not the “complete” code, because it certainly isn’t
enough to run as it is.
I don’t see anything like your results, but it’s also true that I’m
not in Nigeria. Here, it prints out:
<class ‘wx._misc.DateTime’>
09/12/12 00:00:00
Remember that GetDate returns a wx.DateTime object. You can format
that any way you want. You can fetch the individual fields
(GetYear, GetMonth, GetDay), or you can use one of the Format
methods (Format, FormatDate, FormatISODate).
None of this explains why the year would be set to 6427, however.

···

SUNDAY A. OLUTAYO wrote:

    This

is the complete code:

-- Tim Roberts, Providenza & Boekelheide, Inc.

timr@probo.com

The complete code has a lot of TextCtrl s, so I just cut out where attention is needed.
Also I am actually using Ubuntu Linux but I do not think it will be the problem, because date printout on terminal.

I try this but it did not work:

def OnDateChanged(self, evt):
global date
date = FormatISODate(evt.GetDate())

Please put me through on how to use FormatISODate

Thanks,

Sunday Olutayo
Sadeeb Technologies Ltd
7 Mayegun Street, Ojo
Lagos State, Nigeria.

Tel: +234 1 7404524
D/L: +234 1 8169922
Cell: +234 8054600338, 234 8096441688
Fax: +234 8054895664
mail: olutayo@sadeeb.com

        ![sadeeb_icon_v4.png|50x52](upload://pRtE1tECEjI4lA6HQiIdUg2kIPR.png)
···

SUNDAY A. OLUTAYO wrote:

    This

is the complete code:

--
Tim Roberts, Providenza & Boekelheide, Inc.

timr@probo.com

http://groups.google.com/group/wxPython-users?hl=en

Tim,

Thanks a lot, it is working now:

def OnDateChanged(self, evt):
import datetime
global date
mydate = evt.GetDate()
date = mydate.FormatISODate()

Thanks,

Sunday Olutayo

sadeeb_icon_v4.png

···

SUNDAY A. OLUTAYO wrote:

    This

is the complete code:

--
Tim Roberts, Providenza & Boekelheide, Inc.

timr@probo.com

http://groups.google.com/group/wxPython-users?hl=en