Hi, This is probably due to timezone differences which you're ignoring here. Check out the DateUtil class.
On Friday, December 11, 2020 at 8:49:52 AM UTC+2 [email protected] wrote: > Hi, > > I have a small method that returns a string with the time of a date. This > works fine when I show the start and end time, but the difference appears > wrong. Example: Start Time = 8:26:11, End Time = 8:26:13 and Difference =* > 7*: 0: 1. > > My method is: > > private String horaTexto(Long fecha) { > java.util.Calendar c = java.util.Calendar.getInstance(); > Date d = new Date(fecha); > c.setTime(d); > return c.get(java.util.Calendar.HOUR) + ":" + > c.get(java.util.Calendar.MINUTE) + ":" + c.get(java.util.Calendar.SECOND); > } > > Thanks > -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/3c30a9ba-f8b5-44ab-82e7-fae738b75391n%40googlegroups.com.
