Re: [codenameone-discussions] Re: Problems with conversion from milliseconds to date.

2021-06-21 Thread Shai Almog
Notice that date in milliseconds is in GMT/UTC so it should work well universally even if your server is in a different time zone (which is very likely). That's probably the source of the problem you're experiencing. This is why the response from Javier should work as it removes the

Re: [codenameone-discussions] Re: Problems with conversion from milliseconds to date.

2021-06-21 Thread Javier Anton
Try this: public static String cambiaNumeroFecha(Long fecha) { SimpleDateFormat dateFormat = new SimpleDateFormat(); dateFormat.applyPattern("-MM-dd"); Date d = new Date(fecha); return dateFormat.format(d); } Javier On Mon, 21 Jun 2021 at 05:40, rdvg...@gmail.com

[codenameone-discussions] Re: Problems with conversion from milliseconds to date.

2021-06-20 Thread rdvg...@gmail.com
Sorry, correction: public static String cambiaNumeroFecha(Long fecha) { Calendar c = Calendar.getInstance(); Date d = new Date(fecha); c.setTime(d); String r = Integer.toString(c.get(Calendar.YEAR)) + "-" +