Does the date entered fall on a Saturday or Sunday?

Unanswered Question
Apr 6th, 2010

Has anyone had to verify the date, entered by the caller, doesn't fall on a Saturday or Sunday? If so how did you do it? We are running UCCX 5.0(2) premium edition. Thanks.

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Average Rating: 0 (0 ratings)
geoff@hp.com Tue, 04/06/2010 - 18:33

Jump into the Expression Editor and create a GregorianCalendar class. It will tell you all these things, and more. It will deal with leap years and other tricky little things.

Now if you don't know how to use the Expression Editor, please read the manual. It's a bit tricky to describe, but you can actually double-click on where you see the class and type your own class there, and it will make one for you, and then you can use the methods on that class that the editor can see through reflection.

GregorianCalendar is a standard Java class in java.util.* so you will be able to use it.

You basically take their date entry, make a GregorianCalendar, and then check to see if it's the weekend.

NOTE: Month is 0-11, so subtract 1 from what they entered!!! Tricks people up.

GregorianCalendar gc = new GregorianCalendar(int year, int month, int dayOfMonth)

if (gc.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY ||

    gc.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)

// off you go

Regards,

Geoff

Actions

Login or Register to take actions

This Discussion

Posted April 6, 2010 at 6:23 AM
Stats:
Replies:1 Avg. Rating:
Views:323 Votes:0
Shares:0
Tags: No tags.

Discussions Leaderboard