EPMFAQ Forums - Connect with the EPM Community  

Go Back   EPMFAQ Forums - Connect with the EPM Community > EPM Community Forums > Microsoft Project Solution Design


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-23-2010, 06:19 AM
Junior Member
 
Join Date: Jun 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Format Input for SharePoint DateTime field

We can use SharePoint API as well as SharePoint List web reference to update List Items. Using API it is quite straight forward as we can directly assign a DateTime object against a DateTime field in SharePoint list. But with List web reference it is not that straight forward as we need to first convert the DateTime object into the SharePoint DateTime formatted string and then assign it to the specific field.

Provided below are code samples written in C# to format an input as per SharePoint DateTime field.

/* -- Format for Date Only Field -- */
private static String ToSPDate(String strDt)
{
if (strDt == String.Empty)
return strDt;
else
return (Convert.ToDateTime(strDt)).ToString("yyyy-MM-dd");
}

/* -- Format for DateTime Field -- */
private static String ToSPDateTime(String strDt)
{
if (strDt == String.Empty)
return strDt;
else
return (Convert.ToDateTime(strDt)).ToString("yyyy-MM-ddTHH:mm:ssZ");
}

Thanks,
Bijayani
Learn about SharePoint Migration.








Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -4. The time now is 01:43 PM.


Powered by: vBulletin®
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Ad Management by RedTyger

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24