"created" is a magic column name in reports, that triggers automated
formatting. This formatting requires the row values to be epoch time stamps
(seconds since Jan 1, 1970 00:00:00). You will need use a different column
name.

--Noah

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of emx
Sent: Wednesday, May 28, 2008 10:43 AM
To: [email protected]
Subject: [Trac] Formatting dates in reports



I have been trying to customize the SQL of some reports so they display the
date in a different format. I have read around and tried to apply the
examples I could find. However none of my attempts worked, and all resulted
in the same error.

I use trac 0.10.4 on Ubuntu 8

For example consider the query:
select time as CREATED from ticket

I would like to change it so it displays the time as well, so I tried:

select strftime('%Y%m%d-%H%M', datetime(time, 'unixepoch')) as CREATED from
ticket
select strftime('%Y%m%d-%H%M', time, 'unixepoch') as CREATED from ticket
select strftime('%Y%m%d-%H%M', time) as CREATED from ticket

All of them result in:

"TRAC detected an internal error", with the following Python traceback:

Traceback (most recent call last):
  File "/var/lib/python-support/python2.5/trac/web/main.py", line 406, in
dispatch_request
    dispatcher.dispatch(req)
  File "/var/lib/python-support/python2.5/trac/web/main.py", line 237, in
dispatch
    resp = chosen_handler.process_request(req)
  File "/var/lib/python-support/python2.5/trac/ticket/report.py", line 88,
in process_request
    resp = self._render_view(req, db, id)
  File "/var/lib/python-support/python2.5/trac/ticket/report.py", line 346,
in _render_view
    value['date'] = format_date(cell)
  File "/var/lib/python-support/python2.5/trac/util/datefmt.py", line 68, in
format_date
    return format_datetime(t, format, gmt)
  File "/var/lib/python-support/python2.5/trac/util/datefmt.py", line 58, in
format_datetime
    t = time.localtime(float(t))
ValueError: invalid literal for float(): 20080528-22:41


-- 
View this message in context:
http://www.nabble.com/Formatting-dates-in-reports-tp17518209p17518209.html
Sent from the Trac Users mailing list archive at Nabble.com.






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to