DateTimeToXSDate static method

String DateTimeToXSDate(
  1. DateTime date
)
Convert DateTime to XML Schema date. The date to be converted.

Implementation

static String DateTimeToXSDate(DateTime date) {
  // TODO : check validity of DateTimeToXSDate
  print(".. using unsafe DateTimeToXSDate");
//          if (date.isUtc) {
  return DateFormat("yyyy-MM-dd'Z'").format(date);
//          } else {
//            return DateFormat("yyyy-MM-ddzzz").format(date);
//          }

  // Depending on the current culture, DateTime formatter will
  // translate dates from one culture to another (e.g. Gregorian to Lunar).  The server
  // ensure this.
//            String format;
//
//            switch (date.Kind)
//            {
//                case DateTimeKind.Utc:
//                    format = "yyyy-MM-ddZ";
//                    break;
//                case DateTimeKind.Unspecified:
//                    format = "yyyy-MM-dd";
//                    break;
//                default: // DateTimeKind.Local is remaining
//                    format = "yyyy-MM-ddzzz";
//                    break;
//            }
//
//            return date.ToString(format, CultureInfo.InvariantCulture);
}