csrchvz15 Posted March 24, 2020 Share Posted March 24, 2020 Hello good afternoon I want to ask if someone would be able to help me out with a problem that I have with giving the right format to a field in jasper reports.What I want to do is to display a number of hours of a field type time, this is what I have made by far:<textFieldExpression><![CDATA[new java.text.SimpleDateFormat("hh:mm").format($F{TIEMPO_SOPORTE})]]></textFieldExpression>The result I get with that sentence are pretty much what I want to see, but you see right now my problem is that I get some of information incorrectly because if the time is less than an hour I get 12: preceding the minutes.Example:If the field on the database says that the time is 0:15 minutes, the reports says that the information is 12:15.But the data says that the time is more than an hour it displays it correctly.So I wonder if someone could help me out with this problem? Link to comment Share on other sites More sharing options...
Solution csrchvz15 Posted April 5, 2020 Author Solution Share Posted April 5, 2020 After some search I've found out that, if you want to format time in MySQL and MariaDB this is the sentence you should use:SELECT SEC_TO_TIME(SUM(TIME_TO_SEC(TIEMPO_SOPORTE))) AS HorasSoporte FROM YOUR_TABLE Link to comment Share on other sites More sharing options...
csrchvz15 Posted April 5, 2020 Author Share Posted April 5, 2020 You must format the field as a String Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now