Showing posts with label sharepoint 2010. Show all posts
Showing posts with label sharepoint 2010. Show all posts

Wednesday, June 16, 2010

Convert UTC date using Convert.ToDateTime Surprise

While working on a project I had to convert a date string to DateTime object. As the date value was coming from SharePoint it was a UTC date - "2010-01-01T00:00:00Z". So looking at the date value I expected that Convert.ToDateTime or DateTime.Parse will return me 1/1/2011 12:00:00 but to my surprise I was getting 12/31/2010 7:00:00 PM I quickly realized the mistake I was doing and searched MSDN and thanks to SPUtility class for the rescue. So convert UTC date string to a DateTime object use the following method to get the correct date -

objectDateString is object type with value "2010-01-01T00:00:00Z"

SPUtility.CreateSystemDateTimeFromXmlDataDateTimeFormat(objectDateString.ToString()) returns {1/1/2011 12:00:00 AM} System.DateTime

or the following will also return correct date -

Convert(objectDateString.ToString()).ToDateTime().ToUniversalTime()



using DateTime.Parse or Convert.ToDateTime I was getting wrong dates -
DateTime.Parse(objectDateString.ToString()) returns {12/31/2010 7:00:00 PM} System.DateTime

Convert.ToDateTime("2010-01-01T00:00:00Z") return  {12/31/2010 7:00:00 PM}

Again lesson learned to treat DateTime values with respect. :)

For more information in this -
http://www.jamestsai.net/Blog/post/SPRegionalSettingsGlobalTimeZones-How-to-build-world-clock-get-time-zones-information-in-SharePoint.aspx

http://www.novolocus.com/2008/07/31/sharepoint-web-services-and-utc-time-fun-and-games/

Friday, October 23, 2009

Wednesday, October 21, 2009

SharePoint 2010 (Beta) Developer Center

http://msdn.microsoft.com/en-us/sharepoint/ee514561.aspx

What's New in SharePoint Foundation 2010

Atlast for some folks the wait is over here is a list of new features of SharePoint 2010 as posted by Micorosoft -

What's New: Alerts Enhancements

What's New: Business Connectivity Services

What's New: Client Object Model

What's New: Events Improvements

What's New: Microsoft Synch Framework

What's New: Mobile Device Development Enhancements

What's New: Query Enhancements

What's New: Ribbon

What's New: Sandboxed Solutions

What's New: Service Application Framework

What's New: Silverlight Integration and the Fluid Application Model

What's New: UI Improvements

What's New: Windows PowerShell for SharePoint

What's New: Workflow Improvements

SharePoint Products and Technologies (2010)

Finally microsoft started pushing SharePoint 2010 documentation on technet site -

http://msdn.microsoft.com/en-us/library/dd776256.aspx