cancel
Showing results for 
Search instead for 
Did you mean: 

Add Activity

Former Member
0 Kudos

Hi, how can i assign a start date and a start time to an activity with di-api?

i tried it with

oContact.StartTime = Convert.ToDateTime(dtDatum.ToString("dd/MM/yy") + " " + sVon);
        oContact.EndTime = Convert.ToDateTime(dtDatum.ToString("dd/MM/yy") + " " + sBis);

but, it always get assigned "01.12.1899" or so...

what did i do wrong?

Accepted Solutions (1)

Accepted Solutions (1)

YatseaLi
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Phillipp,

Here is an example how to convert string into datetime. Hope it helps.

string[] dateStrings = {"2008-05-01T07:34:42+8:00", 
                        "2008-05-01 7:34:42Z", 
                        "Thu, 01 May 2008 07:34:42 GMT"};
            foreach (string dateString in dateStrings)
            {
                DateTime convertedDate = DateTime.Parse(dateString);
                Console.WriteLine("Converted {0} to {1} time {2}.",
                                  dateString,
                                  convertedDate.Kind.ToString(),
                                  convertedDate);
            }     

            Console.WriteLine("Now waiting for the requests");
            Console.ReadLine();

http://msdn.microsoft.com/en-us/library/1k1skd40.aspx#Mtps_DropDownFilterText

Kind Regards

-Yatsea

Former Member
0 Kudos

yeah, but shall i assign it to oContact.StartTime, or to oContact.StartDate??

YatseaLi
Product and Topic Expert
Product and Topic Expert
0 Kudos

Both.

Answers (0)