2009-04-26

DateTime in MSCRM

How to format string to write in CrmDateTime attribute:


string startdate; // - can be a parameter in method

opportunity oop = new opportunity();

opp.new_startdate = new CrmDateTime();

if(startdate!="")
opp.new_startdate.Value = (Convert.ToDateTime(startdate)).ToString("yyyy-MM-ddTHH:mm:ss");
else
opp.new_startdate.Value = DateTime.Today.ToString("yyyy-MM-ddTHH:mm:ss");

Комментариев нет: