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
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
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)) + "-"
+