# Get Day of Week in Full string

**URL:** <https://forums.pega.com/t/get-day-of-week-in-full-string/1396>\
**Category:** Knowledge Share\
**Tags:** other-industry, user-experience, pega-platform, lead-system-architect\
**Created:** [May 11, 2021, 4:22pm UTC](https://forums.pega.com/t/get-day-of-week-in-full-string/1396 "2021-05-11T16:22:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![KarthickM17452834](https://avatars.discourse-cdn.com/v4/letter/k/ce73a5/32.png) [@KarthickM17452834](https://forums.pega.com/u/KarthickM17452834)\
**Post date:** [May 11, 2021, 4:22pm UTC](https://forums.pega.com/t/get-day-of-week-in-full-string/1396/1 "2021-05-11T16:22:20Z")

</div>

Hi,

Pega Provides feasibility to get weekday in Integer. suppose if we want to get String Name?

Example : 11-May-2021 - Pega gives output from weekday function - 3

If we need full string we can use below approaches :

1. FormatDateTime function will help to get Pattern of day in string with (EEEEE)

@(Pega-RULES:DateTime).FormatDateTime(“20210511T155844.968 GMT”, “EEEEE”, “”, “”)

1. we can write an function, which can have library

Java.time.\*

Integer intobject = new Integer(parseDay);  
int d = intobject.intValue();  
d= d-1;  
DayOfWeek day = DayOfWeek.of(d);  
return day.name();

Note: Why we are subtracting by 1 is pega weekday will give values from 1 as sunday, java will give 0 as sunday. that is the reason we are subtracting.

---

<div class="post-metadata">

**Author:** ![KotaC382](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/kotac382/32/2516_2.png) [@KotaC382](https://forums.pega.com/u/KotaC382)\
**Post date:** [May 13, 2021, 3:16pm UTC](https://forums.pega.com/t/get-day-of-week-in-full-string/1396/2 "2021-05-13T15:16:44Z")

</div>

@KarthickM6092

One more approach is by leveraging Decision Table:

1. Get the day number in a parameter using weekday function. It will return the day number which lies between(1-Sunday to 7-Saturday).

2. Pass the parameter to a decision table where for each day number we can configure corresponding day name. When this is triggered it will return the day name.

---

<div class="post-metadata">

**Author:** ![RaviKumarP17776803](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/ravikumarp17776803/32/19855_2.png) [@RaviKumarP17776803](https://forums.pega.com/u/RaviKumarP17776803)\
**Post date:** [May 14, 2021, 12:32am UTC](https://forums.pega.com/t/get-day-of-week-in-full-string/1396/3 "2021-05-14T00:32:57Z")

</div>

@KarthickM6092 - Good one Karthick. I like the OOTB function with “EEEEE” option. Looks like something missed from your java code, that is fine. Here is another way of writing the java code for the same context. Result is the Local parameter in Pega and we can define it in the activity and print on the screen using Show-Property.

java.util.Date date = new java.util.Date();  
String tempDate = date.toString();  
java.time.LocalDate date = java.time.LocalDate.parse(tempDate);  
java.time.DayOfWeek day = date.getDayOfWeek();  
Result=day.toString();
