For what it's worth, I've come up with a nasty dirty solution which I'm posting here in case anyone else ever needs it...

In my original problem, I had a view which included a column defined like this:

  TimeFormat(time) AS usr_time,

I now have "time AS usr_time" instead, so that the selected value is unformatted. I then tweak the select statement from this:

  SELECT usr_time,facility,event,details
  FROM   user_history_log
  WHERE  username='FOO' AND usr_time LIKE '%oct%'
  ORDER BY time DESC;

to this:

  SELECT TimeFormat(usr_time,'xx') AS usr_time,facility,event,details
  FROM   user_history_log
  WHERE  username='FOO' AND TimeFormat(usr_time,'xx') LIKE '%oct%'
  ORDER BY time DESC;

Since this statement is built in the method that displays the table, the locale is accessible and can be plugged in as a string literal 'xx' as a second parameter to TimeFormat. The filtering is based on the formatted text (which is now correctly localised) and the sorting is still based on the underlying timestamp.

I can't say I'm impressed with the elegance of my code, but what the hell, it works!
--
John English

Reply via email to