Hi guys,

This time i would like to share something that you can do with InfoPath rules and functions. Last week, i needed to use the name of day, but there is no function specific for this task, i thought it is not possible but after a little search i found out that with couple function and understanding of math of date it is possible. Here how i can made it: 1. Create a Date Picker control and a Text Box control, i named it , MyDate and DayOfWeek

2.Using function below, replace “YourDateXPath” with you date picker xpath path name. exm: number(number(substring(../my:MyDate, 1, 4)) 3.  Right click to DayOfWeek kontrol ->TextBox Properties ->Data -> Default Value Section -> Value click little fx button click  Edit Xpath (Advanced) check box and paste code.

4.  Click OK -> OK and you are about to done .

Now you will see only numbers from 0-7 that means 0 is Sunday, 1 is Monday, 2 Tuesday … Lets convert these numbers to day name. 5.  Click DayOfWeek control and select Manage Rules from home ribbon.

6. Click new  to create a rule, then click action.

7.  Set field value 8.  Set  field DayOfWeek and value Sunday ( for 1 we will use Monday) 9. Set condition  DayOfWeek Equal to 1

10. Repeat 6-9 for each day of week 11. you are done.

```
(number(substring("YourDateXPath", 9, 2)) + number(number(substring("YourDateXPath", 1, 4)) - (floor((14 - number(substring("YourDateXPath", 6, 2))) div 12))) + floor(number(number(substring("YourDateXPath", 1, 4)) - (floor((14 - number(substring("YourDateXPath", 6, 2))) div 12))) div 4) - floor(number(number(substring("YourDateXPath", 1, 4)) - (floor((14 - number(substring("YourDateXPath", 6, 2))) div 12))) div 100) + floor(number(number(substring("YourDateXPath", 1, 4)) - (floor((14 - number(substring("YourDateXPath", 6, 2))) div 12))) div 400) + floor((31 * number(number(substring("YourDateXPath", 6, 2)) + 12 * (floor((14 - number(substring("YourDateXPath", 6, 2))) div 12)) - 2)) div 12)) mod 7

```