Calculating day of the week in InfoPath without code

http://www.bizsupportonline.net/infopath2007/create-week-day-infopath-form-rules-formula.htm

http://sharepointissues.blogspot.sg/2012/09/calculating-day-of-week-in-infopath.html

 

(number(substring(Date, 9, 2)) + number(number(substring(Date, 1, 4)) – (floor((14 – number(substring(Date, 6, 2))) / 12))) + floor(number(number(substring(Date, 1, 4)) – (floor((14 – number(substring(Date, 6, 2))) / 12))) / 4) – floor(number(number(substring(Date, 1, 4)) – (floor((14 – number(substring(Date, 6, 2))) / 12))) / 100) + floor(number(number(substring(Date, 1, 4)) – (floor((14 – number(substring(Date, 6, 2))) / 12))) / 400) + floor((31 * number(number(substring(Date, 6, 2)) + 12 * (floor((14 – number(substring(Date, 6, 2))) / 12)) – 2)) / 12)) mod 7

It will return the following:
1) If the value returned in “Day of the Week” field is 0 then it is Sunday
2) If the value returned in “Day of the Week” field  is 1 then it is Monday
3) If the value returned in “Day of the Week” field is 2 then it is Tuesday
4) If the value returned in “Day of the Week” field is 3 then it is Wednesday
5) If the value returned in “Day of the Week” field is 4 then it is Thursday
6) If the value returned in “Day of the Week” field is 5 then it is Friday
7) If the value returned in “Day of the Week” field is 6 then it is Saturday

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s