Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8180245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:10:23+00:00 2026-06-07T00:10:23+00:00

The following SQL Lite statement in Trac SELECT id, changetime / 1000000 as ‘MODIFIED’,

  • 0

The following SQL Lite statement in Trac

  SELECT 
  id,
  changetime / 1000000 as 'MODIFIED',
  strftime('%s',"now") as 'NOW',
  ((strftime('%s',"now")) - (changetime / 1000000)) as 'DIFF'
  FROM ticket
  WHERE (CAST(((strftime('%s',"now")) - (changetime / 1000000)) AS NUMERIC) < 86400.0)

results the following output:

enter image description here

“changetime” is a field from Trac (type: int64). What I want to achieve is that all tickets which changetime is within one week are selected. I had heavy problems because changetime is int64 and strftime returns something different. This is why I am dividing by 1000000.

Now I have the problem that the WHERE statement is always false altough as you can see on the screenshot I have tickets where it applies (made screenshot after removing WHERE clause temporarly).

Does anybody know what is going wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:10:25+00:00Added an answer on June 7, 2026 at 12:10 am
    SELECT
      id,
      changetime as modified,
      strftime('%s',"now") as date,
      (strftime('%s',"now") - changetime / 1000000) as 'DIFF'
    FROM ticket
    WHERE (CAST(strftime('%s',"now") AS NUMERIC) - changetime / 1000000) < 86400.0
    

    works (tested on Trac 0.11 with divider 1 instead of 1.000.000), because you have to do the type conversion before going on with calculation – can’t calculate with the date strings from strftime right-away.

    Note, that some special column names (‘created’, ‘modified’, ‘date’, ‘time’) trigger automagic formatting as date and/or time. TicketQuery works nicer in this respect, as you can specify time limits more natural as changetime=1w..now, but you’re asking implicitely for a solution in the TracReports domain.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following SQL statement SELECT [CodeHouse] ,[CodeReq] ,[Address] FROM [ShahrdariProject].[dbo].[House] where [CodeReq]
I have the following SQL Server query: SELECT area FROM places WHERE REPLACE(area,'-',' ')
I have the following SQL snippet within a select statement: CASE WHEN wot.id LIKE
I have following SQL statementL: select DATE(bla), count(*) from tableA group by DATE(bla) UNION
I have the following SQL statement which has a very bad performance: SELECT frmInstLastModifiedDate
Following SQL get what I need: SELECT TOP (50) [nodeId] FROM [dbo].[cmsContentXml] WHERE [xml]
I have the following sql query: UPDATE (SELECT * FROM table_A INNER JOIN table_B
Following SQL command select TO_CHAR(NVL(arg1 - arg2, TO_DSINTERVAL('0 00:00:00'))) from table1 produces a result
I have the following SQL query: select expr1, operator, expr2, count(*) as c from
I have a following SQL QUERY: SELECT articles.name, articles.price, users.zipcode FROM articles INNER JOIN

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.