[wxPython-users] wx.grid.GridCellDateTimeRenderer

Robin Dunn robin at alldunn.com
Tue Feb 5 14:54:10 PST 2008


Mark Erbaugh wrote:
> On Mon, 2008-02-04 at 10:48 -0800, Robin Dunn wrote:
>> Mark Erbaugh wrote:
>>> Is there any documentation on the informat and outformat parameters to
>>> the constructor for a GridCellDateTimeRenderer?  The default is
>>> wx.DefaultDateTimeFormat which appears to be '%c'.  
>> It should be similar to (or the same as) the format used by the C 
>> strftime function.  Since Python's time.strftime is also based on the 
>> same format strings you can use that doc as a guide too.
> 
> Robin,
> 
> Thanks for the reply.  It looks a little more involved. As near as I've
> been able to determine through experimentation, the informat parameter
> needs to be set.  The data I'm displaying is a Python datetime instance.
> Unless I specify informat='%Y-%m-%d', the date is displayed as
> 'YYYY-MM-DD' regardless of the outformat value. When I correctly specify
> the informat value, the outformat value controls the display.
> 
> Since datetime.print() yields YYYY-MM-DD xxx, I assume that a print()
> conversion is being made converting the datetime to a string and then
> the informat conversion is applied to parse that string. Finally, the
> outformat conversion is applied to get the display value.

Also keep in mind that the GridCellDateTimeRenderer class will be using 
the wx.DateTime class, not Python's datetime, so you should look at the 
docs concerning it.

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





More information about the wxpython-users mailing list