I am trying to display the contents of date column in a different web part. I have not been able to get a string representation that takes into account the explicit "Calendar Type" available in the regional settings.
I am able to get the value from the list item and I use DateTime.ToString("D") to the long format, without any provider. Note - not using a provider ensures that both the Site->Regional Settings and User->MySettings->Regional Settings and the value gets rendered just the way the value in the list column gets rendered.
All this works only as long as the "Calendar Type" is left at its default. The regional settings has the locale and also has the Calendar Type, when this calendar type is changed from the default to say Buddhist, the year changes from 2011 to 2554. This gets rendered fine in the list but when trying to get a string representation of the value using DateTime.ToString it still displays only in the default calendar of the selected locale.
I was not able to create a DateFormatInfo as format provider with the correct calendar since I could not find a direct mapping from the SPCalendarType to the different Globalization Calendars available. I tried converting the date to julian day (from the locales default calendar) using SPIntlCal and then the julian day to the calendar selected, this did not work all the time.
Maybe there is something very simple that I am missing, Any ideas please?
(This is on Sharepoint Server 2010)