ConvertDateTimeToUniversalDateTimeString method

String ConvertDateTimeToUniversalDateTimeString(
  1. DateTime value
)
Converts the date time to universal date time string. The value.

Implementation

String ConvertDateTimeToUniversalDateTimeString(DateTime value) {
  // todo : repair ConvertDateTimeToUniversalDateTimeString
  final dateFormat = DateFormat("yyyy-MM-ddTHH:mm:ss.SSS'Z'", null);
  final formatted = dateFormat.format(value);
  if (!value.isUtc) {
    print(
        "!! .. unsafe ConvertDateTimeToUniversalDateTimeString($value) => $formatted");
  }
  return formatted;
//            DateTime dateTime;
//
//            switch (value.Kind)
//            {
//                case DateTimeKind.Unspecified:
//                    dateTime = EwsUtilities.ConvertTime(
//                        value,
//                        this.TimeZone,
//                        TimeZoneInfo.Utc);
//
//                    break;
//                case DateTimeKind.Local:
//                    dateTime = EwsUtilities.ConvertTime(
//                        value,
//                        TimeZoneInfo.Local,
//                        TimeZoneInfo.Utc);
//
//                    break;
//                default:
//                    // The date is already in UTC, no need to convert it.
//                    dateTime = value;
//
//                    break;
//            }
//            return dateTime.ToString("yyyy-MM-ddTHH:mm:ss.fffZ", CultureInfo.InvariantCulture);
}