Hi, I am using following code to generate chart in jasper.
I am printing date on X-axis. But it is displaying in millisecond. I want to display it in hh:mm:ss format. How to achieve it?
Hi, I am using following code to generate chart in jasper.
I am printing date on X-axis. But it is displaying in millisecond. I want to display it in hh:mm:ss format. How to achieve it?
Following is code for the c# i think you get similar to timespan in j# also
public string getFormattedTimeFromSecond(double second)
{
TimeSpan t = TimeSpan.FromSeconds(second);
string formatedTime = string.Format("{0:D2}H:{1:D2}M:{2:D2}S",
t.Hours,
t.Minutes,
t.Seconds);
return formatedTime;
}
http://www.codeproject.com/Tips/59331/Time-in-HH-MM-SS-format-form-the-second.aspx
You can use following code in Java:
new SimpleDateFormat("MM-dd-yyyy HH:mm:ss z")).format($V{VAR_DATE})
where $V{VAR_DATE} is the date variable to be converted into the format.