Posts

Showing posts from December, 2010

Convert DateTime to CrmDateTime in MSCRM 4.0

Use the below method to convert dateTime to CrmDateTime in MSCRM 4.0. public static CrmDate ConvertToCRMDateTime(DateTime dateTime {           CrmDateTime crmDateTime = new CrmDateTime();           crmDateTime.date = dateTime.ToShortDateString();           crmDateTime.time = dateTime.ToShortTimeString();          TimeSpan offset = TimeZone.CurrentTimeZone.GetUtcOffset(dateTime);          string sOffset = string.Empty;         if (offset.Hours < 0)              {                         sOffset = "-" + (offset.Hours * -1).ToString().PadLeft(2, '0...