get SPFieldDateTime value

DateTime myDateTime = (DateTime) myListItem[“MyDateField”];
or
DateTime myDateTime = DateTime.Parse(myListItem[“MyDateField”].ToString());

 

<in Event Receiver>

DateTime.Parse(item[“Date”].ToString()) 

returns day with hours 00:00 – example: 17.3.2009 0:00:00

DateTime.Parse(_properties.AfterProperties[“Date”].ToString())

returns day with hours 01:00 – example: 17.3.2009 1:00:00

not yet tested ^^

from http://social.msdn.microsoft.com/Forums/sharepoint/en-US/e3675a80-53c8-46a8-af43-2dfc4190a58e/get-datetime-formated-value-from-spfielddatetime

 

Advertisements

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: