I already posted about how to set a date field in infopath by code behind. If you like to read this post, just look at this post. But this post i am gonna explain how to set the date field correctly by just using rules or the formula.
So we should look at first at the anatomy of the date. Mostly you know the date as
- 18.11.2012
- 2012-11-18
- 11/18/2012
or whatelse. It does not matter. You have your date field and set the format as you like. But you can see that infopath saves the date always in this way:
yyyy-mm-ddThh:mm:ss – example: 2012-11-18T12:00:00
If you know that, you are able to use formulas to fill a date field with correct dates. So you have to use a “T” as separator between the date and the time.
In my example i provide dropdowns to choose a birthday. You have three dropdowns and the date field is normally hidden but in this case i left it visible to show you the result. On the datefield i added a a formula to the standard / default value, but you could also use a rule which runs if all three dropwdowns are filled or changed. I set the datefield with a concate(field1;”-“;field2;”-“;field3;”T00:00:00”;) and it works as you can see in the picture below. You should remember that field 1 = year, field 2 = month and field 3 = day. Otherwise field validation will fail.
..:: I LIKE SHAREPOINT ::..