Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Getting the Week count for the Two date range Date: Fri, 13 Apr 2012 11:10:19 -0700 (PDT) Organization: http://groups.google.com Lines: 26 Message-ID: <33458187.121.1334340619743.JavaMail.geo-discussion-forums@pbts20> References: <4dda83fc-0bdf-4039-a70c-90b671996e18@gh10g2000pbc.googlegroups.com> <13575403.14.1334330054189.JavaMail.geo-discussion-forums@pbrh4> NNTP-Posting-Host: 69.28.149.29 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1334340620 5403 127.0.0.1 (13 Apr 2012 18:10:20 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 13 Apr 2012 18:10:20 +0000 (UTC) In-Reply-To: <13575403.14.1334330054189.JavaMail.geo-discussion-forums@pbrh4> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.28.149.29; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Received-Bytes: 2364 Xref: csiph.com comp.lang.java.programmer:13529 fred.l.kl...@ wrote: > George wrote: >> Hi, >> I am using a date application. Here I am giving a date as input >> and the total week count is the output.The week count should be >> calculated from Sunday to Saturday as one week count. Is there any >> method in java to get this format of week count. >> > > Not enough information. > Suppose d1 is a Monday, and d2 is Friday 11 days later. What is the "week count" of this range? Once you have your spec down more precisely, look perhaps to the 'java.util.Calendar' class for ways to implement it. It will require piecemeal assembly of the exact algorithm you want, using things like etc. If all that is too primitive, the Joda Time initiative is very promising: -- Lew