Fabio,
Acho que nao me expliquei direito.
Estou tentando pegar o dia da semana a partir de uma
data qualquer, ok???
Soh se houver um formato para o SimpleDateFormat que
me deh isso. Existe ???
[]s
Marcelo Matos
--- Fabio Augusto Falavinha
<[EMAIL PROTECTED]> escreveu: > Tente esta
classe:
>
> ----------------------------------------
>
> import java.util.Date;
> import java.text.SimpleDateFormat;
> import java.text.DecimalFormat;
>
> public class Formatador {
>
> /** Formato: dd/MM/yyyy */
> public static String FMT_DATA_ABREV =
> "dd/MM/yyyy";
> /** Formato: dd/MM/yyyy HH:mm */
> public static String FMT_DATA_HORA = "dd/MM/yyyy
> HH:mm";
> /** Formato: MM/dd/yyyy HH:mm:ss */
> public static String FMT_DATA_HORA_FULL =
> "MM/dd/yyyy HH:mm:ss";
> /** Formato: MM/dd/yyyy HH:mm */
> public static String FMT_DATA_HORA_USA =
> "MM/dd/yyyy HH:mm";
> /** Formato: yyyyMMddHHmmss */
> public static String FMT_yyyyMMddHHmmss =
> "yyyyMMddHHmmss";
> /** Formato: yyyyMMdd */
> public static String FMT_yyyyMMdd = "yyyyMMdd";
> /** Formato: yyyy/MM/dd HH:mm */
> public static String FMT_TIMESTAMP = "yyyy/MM/dd
> HH:mm";
> /** Formato: yyyy-MM-dd */
> public static String FMT_TIMESTAMP_ABREV =
> "yyyy-MM-dd";
> /** Formato: HH:mm */
> public static String FMT_HORA = "HH:mm";
> /** Formato: MM/dd/yyyy HH:mm:ss */
> public static String FMT_HORA_FULL = "HH:mm:ss";
>
> /**
> * Converte uma data para uma string no formato
> desejado.
> * @param d data a ser convertida
> * @param f formato da string de retorno
> * @return string convertida
> */
> public static String dateToString(Date d,String f)
> {
> String strDate = "";
> if (d != null) {
> SimpleDateFormat formatter = new
> SimpleDateFormat(f);
> strDate = formatter.format(d);
> }
> return strDate;
> }
>
> /**
> * Converte uma string para uma data no formato
> desejado.
> * @param s string a ser convertida
> * @param f formato da string de entrada
> * @return data convertida ou null para erros
> */
> public static Date stringToDate(String s,String
> f)throws Exception
> {
> Date d = null;
> d = (new SimpleDateFormat (f)).parse(s);
> return d;
> }
>
> /**
> * Converte um inteiro para uma string
> * @param number numero a ser convertido
> * @param digits numero de digitos da string de
> retorno
> * @return String string convertida
> */
> public static String formatInt(int number, int
> digits) {
> String s = Integer.toString(number);
> while (s.length() < digits) {
> s = "0" + s;
> }
> if (digits > 0) {
> s = s.substring(s.length() - digits,
> s.length());
> }
> return s;
> }
>
> /**
> * Converte um float para uma string com separador
> comma
> * @param number numero a ser convertido
> * @param dig numero de digitos da string de
> retorno
> * @return String string convertida
> */
> public static String formatFloatComma(double
> number, int dig) {
> String digitos = "#0.0";
> for (int i=1;i<dig;i++) { digitos = digitos +
> "0"; }
> return (new
> DecimalFormat(digitos)).format(number);
> }
>
> /**
> * Converte um float para uma string com separador
> dot
> * @param number numero a ser convertido
> * @param dig numero de digitos da string de
> retorno
> * @return String string convertida
> */
> public static String formatFloatDot(double number,
> int dig) {
> String s = formatFloatComma(number,dig);
> s = s.replace(',','.');
> return s;
> }
>
> }
>
> ----------------------------------------
>
>
> F�bio Augusto Falavinha
> e - Solutions - Sisgraph Ltda.
> e-mail: [EMAIL PROTECTED]
> fone: 55 11 38892136
>
> > -----Original Message-----
> > From: Marcelo Matos
> [SMTP:[EMAIL PROTECTED]]
> > Sent: Monday, December 03, 2001 8:12 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [java-list] subtrair 20 min.
> >
> > Falando na classe Calendar, gostaria de tirar uma
> > duvida: estou setando datas diferentes num objeto
> > instanciado, e , quando pego o DAY_OF_WEEK, ele
> sempre
> > me retorna 0 (zero). � como se ela nao atualizasse
> > esses fields quando a data eh setada ...
> >
> >
> > Alguem sabe me dizer porque e como devo proceder
> para
> > solucionar o problema ???
> >
> >
> > []s
> > Marcelo Matos
> >
> >
> > --- Rodrigo <[EMAIL PROTECTED]> escreveu: >
> De
> > uma alhada na classe java.util.Calendar, com ela
> > > fica f'acil fazer
> > > operacoes com datas.
> > > ----- Original Message -----
> > > From: "Ricardo Striquer Soares"
> > > <[EMAIL PROTECTED]>
> > > To: "PT - Sou Java" <[EMAIL PROTECTED]>
> > > Sent: Thursday, November 29, 2001 8:19 PM
> > > Subject: [java-list] subtrair 20 min.
> > >
> > >
> > > > como faco p subtrair 20 da atual data?
> > > > valeu mesmo.
> > > >
> > > >
> > > >
> > > >
> > >
> >
>
_________________________________________________________
> > > > Do You Yahoo!?
> > > > Get your free @yahoo.com address at
> > > http://mail.yahoo.com
> > > >
> > > >
> > > > ------------------------------ LISTA SOUJAVA
> > > ----------------------------
> > > > http://www.soujava.org.br - Sociedade de
> > > Usu�rios Java da Sucesu-SP
> > > > d�vidas mais comuns:
> > > http://www.soujava.org.br/faq.htm
> > > > regras da lista:
> > > http://www.soujava.org.br/regras.htm
> > > > para sair da lista: envie email para
> > > [EMAIL PROTECTED]
> > > >
> > >
> >
>
-------------------------------------------------------------------------
> > >
> > >
> > > ------------------------------ LISTA SOUJAVA
>
=== message truncated ===
_______________________________________________________________________________________________
Yahoo! GeoCities
Tenha seu lugar na Web. Construa hoje mesmo sua home page no Yahoo! GeoCities. � f�cil
e gr�tis!
http://br.geocities.yahoo.com/
------------------------------ LISTA SOUJAVA ----------------------------
http://www.soujava.org.br - Sociedade de Usu�rios Java da Sucesu-SP
d�vidas mais comuns: http://www.soujava.org.br/faq.htm
regras da lista: http://www.soujava.org.br/regras.htm
para sair da lista: envie email para [EMAIL PROTECTED]
-------------------------------------------------------------------------