Tuesday, October 6, 2009

Center align a div in IE 8

Usually when I want to center align a div on a page, I use margin:auto auto and set my width to a specific width, like 940px in my stylesheet. But, this does NOT work in IE 8. So to make that work, use

left:50% (to tell that your div should start in the middle of the page)
margin-left:-490px (half of your div size)

Thanks to this site

Sunday, October 4, 2009

Calculate date fields in SharePoint lists

I wanted a custom view where the news are sorted per Year and Month, and then after modified date descending order. I created a new field called Year and used the following formula to calculate year which is really easy:


Then I wanted to get the name of the month instead of the number so I used this formula (this is the swedish version, use comma instead of semicolon in the english version):

=OM(MÅNAD(Skapad)=1;"Januari";"")&OM(MÅNAD(Skapad)=2;"Februari";"") and so on... You must put an empty "" after or else it will write the word "False" in your view =)

In English:

=IF(MONTH(Created)=1, "January","")