Hi - I am using SecondsToTime Converter plugin to display time in my application. There are occasions where I need to display a negative time (to show for example I am deducting 5 hours).
I have all of this working functionally however the display of a negative time comes out as, for example, 0-5:00 or 0-10:00.
I am looking for a way to manipulate the display - any ideas?
Essentially - need to maniplate the display value to get rid of the first 2 chars.
Regards
D
Could you send a screenshot?
You could use the truncated feature to only take the last x number of characters.
Or you could do a “Find and Replace” and have find=“-” and replace=“”
It kind of depends whether this is just visual or if it still needs to be in a date/time format, but I would assume that because its showing this negative, it is probably stored as text, so these options could work.
Hi Sam
In the database the hours are stored as seconds / negative seconds (e.g. 18000 or -18000) so it is purely the display. SecondsToTime converter returns a format of 00:00:00 (which I truncate to 5 e.g. 05:00). But when it is a negative it returns 0-xx:00:00. I want to get rid of the ‘0-’ for double digit hours and the same for single digit hours but with the added complication of adding a leading zero. So 0-5:00 becomes 05:00 and 0-10:00 becomes 10:00.
UPDATE: - I am almost there but not quite. If I do a simple find/replace of ‘0-’ with ‘’ I can now get 10:00 for double digit hours or ‘5:00:’ for single digit hours. Notice the trailing colon though. This occurs as I am truncating the result to 5 and as there is no leading zero for single digit hours this is what I get.
Any suggestions?
Regards
D