From: Alex T. <al...@tw...> - 2005-07-15 22:20:42
|
kim...@ya... wrote: >Hi list, > >Took some headscratching to figure out that I can get >at the date string of a calendar object from: > > dateObj = self.components.caCalendar.date > >where caCalendar is a PythonCard calendar object. > >Does anybody know of an easy way to convert the date >object that comes back to a standard string like: > > Thursday, July 15 2005 > > > I had some code that used Pythoncard calendar objects, but it's been a while since I looked at it. What I did then was > result = calDialog.calDialog(self, date) > if result.accepted: > date = result.date > self.components.DateYear.value = date.GetYear() > self.components.DateMonth.value = date.GetMonth() + 1 > self.components.DateDay.value = date.GetDay() > else: > s = "No date entered" I think (but haven't tried it out) that it's a wxDateTime, so any of the functions listed in the wx Docs could be used - so you could do s = date.FormatDate() to get the "standard representation", or s= date.Format(formatstring) where formatstring takes the same values as stdlib's strftime() (See also Python datetime documentation which covers strftime options) -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.8.14/48 - Release Date: 13/07/2005 |