🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #18022

Re: HELP: Calendar, DateFormat class

#18022
From: Chris Hill
Date: Thu, 20 Aug 1998 00:00
30 lines
1491 bytes
Use the last parameter to determine thr portion of the StringBuffer
you are interested in.  Here is a brief example:

    StringBuffer sb = new StringBuffer();
    char buf[] = new char[50];
    FieldPosition fp = new
FieldPosition(DateFormat.DAY_OF_WEEK_FIELD);

    DateFormat df = DateFormat.getDateInstance(DateFormat.FULL, new
Locale("ES", "es"));
    df.format(new Date(), sb, fp);

    sb.getChars(fp.getBeginIndex(),fp.getEndIndex(), buf, 0);
    String day_of_week = new String(buf, 0, fp.getEndIndex() -
fp.getBeginIndex());

On Thu, 20 Aug 1998 11:41:28 +0100, zav <zav@gic-net.com> wrote:
>The other is format(Date dateobj, StringBuffer stringobj, FieldPosition
>fieldposition)
>
>The latter method always outputs the full date String rather than just
>the fieldPosition you're interested such as Monday, Lundi etc...
>
>Can anyone explain how you can get this sort of information out of these
>classes???  Any help would be much appreciated.
>Thanks in advance.
>

Chris Hill
hillca@cs.purdue.edu
Technical Details
Message-ID: <35dc4d53.313524544@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <35DBFD58.6BCC6EF3@gic-net.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,90391de4ef3c5f18
X-Google-Attributes: gidf74b3,public
From: hillca@cs.purdue.edu (Chris Hill)
Subject: Re: HELP: Calendar, DateFormat class
Date: 1998/08/20
Message-ID: <35dc4d53.313524544@forums.borland.com>
X-Deja-AN: 383036468
References: <35DBFD58.6BCC6EF3@gic-net.com>
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.language