velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JoseBovet <jose.bo...@gmail.com>
Subject Re: I need help with date format
Date Tue, 13 Nov 2007 18:43:54 GMT

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 <jose.bovet@gmail.com> 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: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
> 
> 
> 
>  __________________________________________________
> 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: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message