Re: Newbie Date SimpleDateFormat HELL

From: Nobody (nobody_at_domain.invalid)
Date: 02/23/05


Date: Wed, 23 Feb 2005 06:39:51 GMT

myfirstname@gmx.net wrote...
> In message <MPG.1c85d32932cffdef98a0f7@news.verizon.net>,
> Nobody wrote on Wed, 23 Feb 2005 04:51:54 GMT:
>
> > I'm trying to create an ANSI date string to use at the end of a file
> > name. "20050222" for today, for example.
> [...]
> > SimpleDateFormat sdf = new SimpleDateFormat( "yyyyMMdd" ) ;
> > Date date = new Date() ;
>
> String formattedDate = sdf.format( date );
>
> http://java.sun.com/docs/books/tutorial/i18n/format/simpleDateFormat.html
>
> I don't know what you are trying to do with that Stringbuffer...

Oh, just fumbling through the doc for SimpleDateFormat...

format

public StringBuffer format(Date date,
                           StringBuffer toAppendTo,
                           FieldPosition pos)

    Formats the given Date into a date/time string and appends the result to the given StringBuffer.



Relevant Pages

  • Re: Help with double arithmetic
    ... >>> I need to extract this value but ... Just wanted to get him started with format, expecting that he would look it ... > Secondly, your last line calls format, converts the StringBuffer to a ... > Standards bodies are goofy things in my estimation. ...
    (comp.lang.java.programmer)
  • Re: Newbie Date SimpleDateFormat HELL
    ... >> I don't know what you are trying to do with that Stringbuffer... ... wanting to append the date to some other string. ... The overloaded version of format you mention is only ... in your case it doesn't matter what FieldPosition you pass ...
    (comp.lang.java.help)
  • Re: Replace method in stringbuffer
    ... public StringBuffer replace (StringBuffer str, String searchString, ... return buffer.replace(start, end, newString); ...
    (comp.lang.java.programmer)
  • Re: Replace method in stringbuffer
    ... public StringBuffer replace(StringBuffer str, String searchString, ... StringBuffer buffer = new StringBuffer); ...
    (comp.lang.java.programmer)