Created Date in SPListItemVersion does not respect locale settings?

A Quick post! On a recent project we had a custom control that was showing document version history information such as “Created By” and “Date Created” in a table format, it was looking all good. After the day light savings time (British Summer Time) one of the tester spotted a bug in document version history control where “Date Created” was still showing the GMT time, it looked like SPListItemVersion.Created was not respecting day light savings time.

TimeZone.xml looked good and every other Dates on the site were showing correct time. It turns out that SPListItemVersion.Created was only showing time in GMT (Don’t know why!) so a simple fix was to convert the time into local time at the render time.


lblDateCreated.Text = version.Created.ToLocalTime().ToString();

Advertisements

2 thoughts on “Created Date in SPListItemVersion does not respect locale settings?

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s