Edgewall Software

Ticket #2219 (closed defect: worksforme)

Opened 3 years ago

Last modified 3 years ago

Bad result from "date(changetime)" in report sql statement

Reported by: anonymous Owned by: daniel
Priority: normal Milestone:
Component: report system Version: 0.8.4
Severity: normal Keywords:
Cc:

Description

The following SQL statement in my report produces a incorrect output for the date of the changetime field:

SELECT id AS ticket, date(changetime) AS 'Date Closed',

summary, component, time AS created FROM ticket WHERE status = 'closed' ORDER BY changetime DESC

For example, the 'Date Closed' column in the report will contain "3086946-03-20" for the date, expecting something like "2005-10-13".

When using "SELECT id AS ticket, changetime AS 'Date Closed'" instead, the result is "1129205013", which is expected for a Unix Timestamp.

Cheers, Bruce Clark SAIC 410-865-7661

Attachments

Change History

Changed 3 years ago by anonymous

Forgot to add my email address. Bruce.A.Clark@…

Changed 3 years ago by mgood

  • status changed from new to closed
  • resolution set to worksforme

In the future please use the MailingList or IrcChannel to ask for support on writing reports instead of filing a ticket, since this doesn't really represent a bug in Trac.

You need to let SQLite know what format the date is in, which can be done like:

select date(changetime, 'unixepoch') from ticket

Or if you need to specify an alternate format:

select strftime('%m/%d/%Y', changetime, 'unixepoch') from ticket

Refer to the SQLite documentation for more information on the date and time functions: http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions

Add/Change #2219 (Bad result from "date(changetime)" in report sql statement)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from daniel. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.