My app sends the date in milliseconds to a WS. Upon receiving it, I convert 
it to date format in the WS, but it appears to me with differences with 
respect to the initial value.
I decided to send the date in string format and as my logic in the app 
always uses the date in milliseconds, it seemed correct to create a method 
to return the date in string.

The problem I have is that he always returns me with a wrong month. I have 
tried to use DateUtil, but can't find a way to apply it.

My method is as follows and I appreciate the support.

    public static String cambiaNumeroFecha(Long fecha) {
        Calendar c = Calendar.getInstance();
        Date d = new Date(fecha);

         String r = Integer.toString(c.get(Calendar.YEAR)) + "-"
                + Integer.toString(c.get(Calendar.MONTH)) + "-"
                + Integer.toString(c.get(Calendar.DAY_OF_MONTH));
        return r;
    }

-- 
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/bc688f1c-6b71-4975-9941-db845027ad4dn%40googlegroups.com.

Reply via email to