Search code examples
fossil

How to display correct local time on view ticket page in fossil


I see the ticket view page display like

username added on 2015-10-29 08:51:00:

In fact, it should be 2015-10-29 16:51:00:

My time zone is GMT+8, so I changed the view ticket from

...
query {SELECT datetime(tkt_mtime) AS xdate, login AS xlogin,
...
html " added on $xdate:\n"
...

To

...
query {SELECT datetime(tkt_mtime+8/24) AS xdate, login AS xlogin,
...
html " added on $xdate:\n"
...

But, it won't work.


Solution

  • Tip: "it won't work" is not a good description of your problem. You're much more likely to get (effective) help if you describe what exactly goes wrong; what you expected to happen, what did happen, and what message appeared.

    That said...

    Use SELECT datetime(tkt_mtime, 'localtime') as xdate to convert utc to your local time zone.

    Check out SQLite's documentation on date functions for more info.