Nick Grattan's Blog

About Microsoft SharePoint, .NET, Natural Language Processing and Machine Learning

WSS 3.0 Web Services – How To Update Date/Time Values

with 3 comments

When adding or updating list items using the WSS Web Service ‘UpdateListItems’ method you need to pass data / time values as strings. The format should be passed in the form ‘yyyy-mm-ddThh:mm:ssZ”.

This specifies a ISO date/time format with time zone information. The “Z” indicates that the time is in “Coordinated Universal Time” (UTC).

The “ToString” method for a DateTime object (e.g. “dt” below) can be used to format a date/time using this format by passing the “u” format descriptor:

String s = dt.ToString(“u”);

Note that the DateTime object must first be converted from local time to UTC. The DateTime “ToUniversalTime” method will do this.

 

Advertisements

Written by Nick Grattan

February 22, 2008 at 11:20 am

3 Responses

Subscribe to comments with RSS.

  1. […] WSS 3.0 Web Services – How To Update Date/Time Values […]

  2. We are utilizing the Sharepoint Web Services to Add and Update SP Lists but are getting wierd results in that the ‘Stored’ Value on the DB is 1 hour different than the Date Value passed in.

    The SP Site is going to be used by many people in different Timezones so my questions are:

    – what timezone should the SP regional seetings be set to? GMT / GMT – 5, etc
    – does the the date being ‘passed’ in have to be converted to utc first?

    ex. I want to pass in 8:00 AM EDT, to be displayed in a SP List.

    Thanks

    Andrew E. Kirin

    Andrew E. kirin

    September 17, 2008 at 7:27 pm

  3. Thanx

    Vladimir Maximov

    July 20, 2011 at 8:55 am


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

%d bloggers like this: