VJOY
VJOY

Reputation: 3792

Incorrect universal time format in input in dynamics CRM 365

In my Crm solution, I have changed a Date time behaviour to time zone independent. enter image description here I am trying to create a record of that entity from c# service code.

campaignResponseToSave.startdate = dateTimeStamp;

Sdk create method is throwing an error as incorrect universal time provided in input.

Does anyone have idea what could be wrong in this?

Upvotes: 0

Views: 1600

Answers (1)

Nick
Nick

Reputation: 755

Time zone independent means you cannot have a time zone. All dates will have one by the default. You can use DateTime.ToUniversalTime() to achieve this. Like so:

string ds = "2007-10-04T00:00:00-04:00";
DateTime dt = DateTime.Parse(ds).ToUniversalTime();

Upvotes: 1

Related Questions