Results from wxCalendarctrl

I need to parse the results from a wxCalendar into at least Year, Month
and Day. Can anyone help me out-

  Thanks

wxStaticText(self,-1,"Admit Date",wxPoint(20,90))
self.date_ctrl_1 = wxCalendarCtrl(self, 101, wxDateTime_Now(), pos =
(20,110),style = wxCAL_SHOW_HOLIDAYS | wxCAL_SUNDAY_FIRST)
EVT_CALENDAR_SEL_CHANGED(self, 101, self.OnDate1)

    def OnDate1(self,event):
        tadmitdate= event.GetDate()

Mike Wagman wrote:

I need to parse the results from a wxCalendar into at least Year, Month
and Day. Can anyone help me out-

  Thanks

wxStaticText(self,-1,"Admit Date",wxPoint(20,90))
self.date_ctrl_1 = wxCalendarCtrl(self, 101, wxDateTime_Now(), pos =
(20,110),style = wxCAL_SHOW_HOLIDAYS | wxCAL_SUNDAY_FIRST)
EVT_CALENDAR_SEL_CHANGED(self, 101, self.OnDate1)

    def OnDate1(self,event):
        tadmitdate= event.GetDate()

See the docs for wxDateTime. That is the type of the object you get here.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

> I need to parse the results from a wxCalendar into at least Year, Month
> and Day. Can anyone help me out-
>
> Thanks
>
>
> wxStaticText(self,-1,"Admit Date",wxPoint(20,90))
> self.date_ctrl_1 = wxCalendarCtrl(self, 101, wxDateTime_Now(), pos =
> (20,110),style = wxCAL_SHOW_HOLIDAYS | wxCAL_SUNDAY_FIRST)
> EVT_CALENDAR_SEL_CHANGED(self, 101, self.OnDate1)
>
>
> def OnDate1(self,event):
> tadmitdate= event.GetDate()
>

See the docs for wxDateTime. That is the type of the object you get here.

You can use tadmitdate.Format('%d/%m/%Y') if you are looking for a
formatted date (or tadmitdate.Format('%m/%d/%Y') depends on your local
settings).
d = tadmitdate.Format('%d') #day
m= tadmitdate.Format('%m') #month
y = tadmitdate.Format('%Y') #year
wxDateTime::Format method returns string objects.