My current assignment has made me get back into the groove of SharePoint web part development and I really have enjoyed it a lot even though my love is really with InfoPath 2007 and InfoPath Forms Services. The code that I'm doing is unfortunately not something I can share but I can still talk about what I did and what resources I used to solve my situation.
This project has several custom web parts and they all have a date columns and the company is international (does this sound familiar). So I started to look at how to change the date format to be dd-mmm-yyyy but one of their requirements was that they wanted all date fields to have the same format no matter if it was custom or out of the box. After I learned this information I already knew deep down dd-mmm-yyyy date format was out of the question because of time constraints and I didn't have the option to create new definitions or use SharePoint Designer (I'm still not 100% sure if I could have accomplished this with those options). I then turned my focus on using the Regional Settings option under Site Administration from the site Settings.aspx page.
I noticed when I changed the Locale all the dates would change even the date fields in the custom web parts without any extra code. I thought this was a great thing and then it dawned on me that we could just educate all the users on how set their personal My Regional Settings and then all the dates would change without any extra code.
When I tested this I discovered that all out of the box dates changed but none of the custom dates changed. After I discovered this I started researching and found the following links and discovered how to format the date per the Locale from their My Regional Settings page if it was different from the site Regional Settings page. Find the necessary information and putting it together was not difficult at all but there wasn't just one source that had all the information.
I found this link and it gave me the information about the Locale ID that is specified in the My Regional Settings that I needed.
http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.spregionalsettings.localeid.aspx
This link gave great information on how to format dates with Locale ID
http://msdn2.microsoft.com/en-us/library/5hh873ya.aspx
This link showed me how to get the current user object from the SPWeb object, which has the regional settings information
http://msdn.microsoft.com/msdnmag/issues/08/02/OfficeSpace/default.aspx
This solution really didn't take that long to put together and it was really easy to find all the information I needed through the search engines. When SharePoint 2003 was released a solution like this would be nearly impossible or couldn't be done. Over the last year and half I've been really impressed how much more versatile SharePoint 2007 is compared to the older version and I can't wait to see the new changes for the next version of SharePoint.
Cheers,
Michael