Thanks htila

        public static String FormatoFechaEnc(int fecha) {

                SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
                SimpleDateFormat sdfa = new SimpleDateFormat("dd-MM-yyyy");

                int idate = fecha;

                String sdate = new String(idate + "");
                java.util.Date ddate = sdf.parse(sdate, new ParsePosition(0));

                return sdfa.format(ddate);

        }

in the controller 

nuevaFecha = General.FormatoFechaEnc(encabezado.getFectra());

model.put("nuevaFecha", nuevaFecha);

in the vm page
<td>$nuevaFecha</td>

it's works...
Thank you very much 

rgs







htila tha wrote:
> 
> Hi,
> 
> Might not be good. But it works.
>       SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
>       SimpleDateFormat sdfa = new SimpleDateFormat("dd-MM-yyyy");
>    
>       int idate = 20071101;
>       String sdate = new String(idate+"");
>       java.util.Date ddate = sdf.parse(sdate, new ParsePosition(0));
>       System.out.println(sdfa.format(ddate));
>   rgds
> 
> JoseBovet <[EMAIL PROTECTED]> wrote: 
> hi guy's
> 
> 
> I have a  problem with a date format, 
> I need format a Integer to Date  or Integer to String
> a example:
> 
> int number1 20070101 to date format (01-01-2007)
> or
> 
> int number1 20070101 to String format (01-01-2007)
> 
> number1 is get for  method in a DB oracle!!!
> 
> 
> greetings°
> 
> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/I-need-help-with-date-format-tf4767519.html#a13636581
> Sent from the Velocity - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
>  __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 

-- 
View this message in context: 
http://www.nabble.com/I-need-help-with-date-format-tf4767519.html#a13731949
Sent from the Velocity - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to