Results 1 to 3 of 3

Thread: Date Falls On A Weekend?

  1. #1

    Thread Starter
    Addicted Member MethadoneBoy's Avatar
    Join Date
    Oct 2001
    Location
    Preferably somewhere between Keira Knightley and Diane Kruger but I'm not fussy
    Posts
    180

    Date Falls On A Weekend?

    Hi guys,

    Is there any way to determine if a particular date falls on a Weekend using the Calendar class? Just curious to see if there's a way to do it without resorting to

    Code:
    int currentday = Calendar.DAY_OF_WEEK
    
    if (currentday == Calendar.SATURDAY || currentday == Calendar.SUNDAY)
    
    //etc...
    "'Oh, hello Mr. Crick! What do you think of Jeffrey Archer?' Clip-clip-clip! Oh, come on! Who are you kidding? You wait til I'm mayor, you'll see how tough I am! Christ almighty...."

  2. #2
    Addicted Member TBeck's Avatar
    Join Date
    Apr 2006
    Location
    Ontario, Canada
    Posts
    254

    Re: Date Falls On A Weekend?

    going through the javadoc for the calandar class I can't see any simplier way then comparing it to saturday and sunday

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Date Falls On A Weekend?

    There isn't. Of course, the OP's code is simply incorrect. The correct code is
    Code:
    int currentday = new GregorianCalendar().get(Calendar.DAY_OF_WEEK);
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width