Hi,
I don't understand the problem. We have SimpleDateFormat in Codename One 
it's just under the codename one packages in the import.

On Thursday, June 24, 2021 at 11:35:56 AM UTC+3 [email protected] wrote:

> Hi,
>
> I created a new method in CodenameOne, but it is sending me an error. 
> To test:
>   fecha = new Date (). ToString () 
>   tipo = "T"
>
>     public static String cambiaFormatoFecha(String fecha, String tipo) {
>         String formato = tipo.equals("F") ? "yyyy-MM-dd" : 
> tipo.equals("H") ? "hh:mm:ss" : tipo.equals("T") ? "yyyy-MM-dd hh:mm:ss" : 
> "";
>         SimpleDateFormat formaFecha = new SimpleDateFormat(formato);
>         Date d = null;
>         try {
>             d = formaFecha.parse(fecha);
>         } catch (ParseException ex) {
>             Dialog.show("Error", "Error formato de fecha", "Continuar", 
> null);
>         }
>         return formaFecha.format(d);
>     }
>
> El Wednesday, June 23, 2021 a la(s) 11:17:52 PM UTC-5, [email protected] 
> escribió:
>
>> Hi,
>>
>> In java you could have the following method:
>>
>> public static Date ParseFecha(String fecha) { 
>>      SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy"); 
>>      Date fechaDate = null; 
>>      try { 
>>            fechaDate = formato.parse(fecha); 
>>       }   
>>            catch (ParseException ex) {
>>                System.out.println(ex); 
>>       } 
>>      return fechaDate; 
>>  }
>>
>> How can I get this to work in CodenameOne?
>>
>

-- 
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/908e2e0c-ede8-4864-aebe-525fdc011492n%40googlegroups.com.

Reply via email to