🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #8289

Re: How do I display the system date

#8289
From: John McGrath TeamB
Date: Fri, 29 Sep 2000 00:00
27 lines
1482 bytes
On Thu, 28 Sep 2000 11:30:57 -0700, Kevin Dwan wrote:

> In a reply to a person asking how to get the date as an int, posted to
> public.jbuilder.java.lang, John McGrath of TeamB suggested this code,
> which you should be able to adapt to your purpose.
> 
> Calendar calendar = Calendar.getInstance();
>     calendar.setTime( new Date() );
>     int year = calendar.get( Calendar.YEAR );
>     int month = calendar.get( Calendar.MONTH );
>     int day = calendar.get( Calendar.DAY_OF_MONTH );

You also may want to take a look at the java.text.DateFormat class.  It 
can be used to format a date string, and is localized, so it can generate 
the appropriate strings for different countries and languages.

If you want to get the individual fields, the Calendar class is the one 
to use.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <MPG.143e2abba0cae769989b9a@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <39d319c7_2@dnews> <39D38E61.D1D88087@blueberry.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,410182b4cd3f3dbc
X-Google-Attributes: gid111d45,public
From: John McGrath  [TeamB] <ng-b@JPMcGrath.net>
Subject: Re: How do I display the system date
Date: 2000/09/29
Message-ID: <MPG.143e2abba0cae769989b9a@forums.borland.com>
X-Deja-AN: 675467892
References: <39d319c7_2@dnews> <39D38E61.D1D88087@blueberry.com>
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.swing