try:
int dayOfWeek = currentDate.toDateTimeAtMidnight(DateTimeZone.UTC).getDayOfWeek();

Stephen



On 06/03/06, Benoit Xhenseval < [EMAIL PROTECTED]> wrote:
Hello

Given a YearMonthDay object, what is the easiest and most efficient way to
get the day of week?

I have tried:
int dayOfWeek = currentDate.get(DateTimeFieldType.dayOfWeek());
return (dayOfWeek == DateTimeConstants.SATURDAY || dayOfWeek ==
DateTimeConstants.SUNDAY);

But this seems to give me an exception:

Field 'dayOfWeek' is not supported
java.lang.IllegalArgumentException: Field 'dayOfWeek' is not supported
    at
org.joda.time.base.AbstractPartial.indexOfSupported(AbstractPartial.java:188
)
    at org.joda.time.base.AbstractPartial.get(AbstractPartial.java:149)

Any suggestion?

Many thanks

Benoit



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest


Reply via email to