Seshu wrote:
> Hi All,
> I am using Calendar objects in my application and based on
> the current date i am retrieving first and last date of current week.
> In emulator o/p is coming as week starting from Sunday to Saturday
> correct and in some device the o/p is showing as Monday to Sunday. I
> used same code in java. there also o/p is showing from Sunday to
> Saturday only. i need the output as Sunday to Saturday only. I used
> these code..
>
> Calendar cal = Calendar.getInstance();
> int weekOfYear = cal.get(Calendar.WEEK_OF_YEAR);
> cal.set(Calendar.WEEK_OF_YEAR, weekOfYear);
> SimpleDateFormat formatter = new
> SimpleDateFormat("MM/dd/yyyy");
>
> Calendar first = (Calendar) cal.clone();
> first.add(Calendar.DAY_OF_WEEK,
> first.getFirstDayOfWeek() -
> first.get(Calendar.DAY_OF_WEEK));
> Calendar last = (Calendar) first.clone();
> last.add(Calendar.DAY_OF_YEAR, 6);
>
> String fromDate = formatter.format(first.getTime());
> String toDate = formatter.format(last.getTime());
>
> If anybody knows the reason means then plz tell me the solution. if
> these method is wrong means then plz send the code....
>
> Thanks for All,
> S.Seshu
read carefully Calendar's documentation
pskink
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en