🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Calendar help (Days of Month)

#17552
From: torsten.welches
Date: Fri, 30 Oct 1998 00:00
29 lines
1621 bytes
well, not very elegant, but this will do the trick:

Calendar cal = cal.getInstance();
cal.set(Calendar.DAY_OF_MONTH, 1); //goto first of this month
cal.add(Calendar.MONTH, 1); //goto next month
cal.add(Calendar.DAY_OF_MONTH, -1); //goto last day of this month
System.out.println(cal.get(Calendar.DAY_OF_MONTH));

Good luck
Torsten Welches
debis Systemhaus

In article <01be03f0$3f3317e0$6bcc79c0@pc4107.stmf.se>,
  "Johan" <urk@slem.se> wrote:
> I'm going quietly insane trying to figure out how to get the
> number of days in the current month... (jdk1.2)
>
> Calendar cal = Calendar.getInstance();
> cal.getMaximum(cal.DAY_OF_MONTH);
>
> will always return 31, so that's not it.
> getLeastMaximum returns 28, so that's not it either.
>
> Anyone?
>
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    
Technical Details
Message-ID: <71cms0$qjr$1@nnrp1.dejanews.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <01be03f0$3f3317e0$6bcc79c0@pc4107.stmf.se>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,3bd436b7dd5bc64c
X-Google-Attributes: gidf74b3,public
From: torsten.welches@gerling.de
Subject: Re: Calendar help (Days of Month)
Date: 1998/10/30
Message-ID: <71cms0$qjr$1@nnrp1.dejanews.com>
X-Deja-AN: 406684015
References: <01be03f0$3f3317e0$6bcc79c0@pc4107.stmf.se>
X-Http-Proxy: 1.0 tidecgn0002:81, 1.0 x9.dejanews.com:80 (Squid/1.1.22) for client 193.158.55.74
Organization: Deja News - The Leader in Internet Discussion
X-Article-Creation-Date: Fri Oct 30 15:43:59 1998 GMT
Newsgroups: borland.public.jbuilder.java.language
X-Http-User-Agent: Mozilla/2.0 (compatible; MSIE 3.02; Update a; AK; Windows NT)