Skip to content

Instantly share code, notes, and snippets.

@gauravkhuraana
Last active May 20, 2022 06:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gauravkhuraana/51facfc9a2fc66c0d80231a9bd992ce4 to your computer and use it in GitHub Desktop.
Save gauravkhuraana/51facfc9a2fc66c0d80231a9bd992ce4 to your computer and use it in GitHub Desktop.
Groovy Script to get the particular day of a week
// I have used this in SOAPUI for Groovy scripting
def date = new Date()
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
def day = calendar.get(Calendar.DAY_OF_WEEK);
def map=[
1:"Sunday",
2:"Monday",
3:"Tuesday",
4:"Wednesday",
5:"Thursday",
6:"Friday",
7:"Saturday"]
log.info map[day]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment