public static string ToString(DateTime value, XmlDateTimeSerializationMode dateTimeOption) { switch (dateTimeOption) { case XmlDateTimeSerializationMode.Local: value = SwitchToLocalTime(value); break; case XmlDateTimeSerializationMode.Utc: value = SwitchToUtcTime(value); break; case XmlDateTimeSerializationMode.Unspecified: value = new DateTime(value.Ticks, DateTimeKind.Unspecified); break; case XmlDateTimeSerializationMode.RoundtripKind: break; default: throw new ArgumentException(Res.GetString("Sch_InvalidDateTimeOption", new object[] { dateTimeOption, "dateTimeOption" })); } XsdDateTime time = new XsdDateTime(value, XsdDateTimeFlags.DateTime); return time.ToString(); }
protected static string TimeToString(DateTime value) { XsdDateTime time = new XsdDateTime(value, XsdDateTimeFlags.Time); return(time.ToString()); }
public static string ToString(DateTimeOffset value) { XsdDateTime time = new XsdDateTime(value); return time.ToString(); }
protected static string GYearMonthToString(DateTime value) { XsdDateTime time = new XsdDateTime(value, XsdDateTimeFlags.GYearMonth); return(time.ToString()); }
protected static string GYearOffsetToString(DateTimeOffset value) { XsdDateTime time = new XsdDateTime(value, XsdDateTimeFlags.GYear); return(time.ToString()); }
///<include file='doc\XmlConvert.uex' path='docs/doc[@for="XmlConvert.ToString14"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public static string ToString(DateTime value, XmlDateTimeSerializationMode dateTimeOption) { switch (dateTimeOption) { case XmlDateTimeSerializationMode.Local: value = SwitchToLocalTime(value); break; case XmlDateTimeSerializationMode.Utc: value = SwitchToUtcTime(value); break; case XmlDateTimeSerializationMode.Unspecified: value = new DateTime(value.Ticks, DateTimeKind.Unspecified); break; case XmlDateTimeSerializationMode.RoundtripKind: break; default: throw new ArgumentException(SR.Format(SR.Sch_InvalidDateTimeOption, dateTimeOption, nameof(dateTimeOption))); } XsdDateTime xsdDateTime = new XsdDateTime(value, XsdDateTimeFlags.DateTime); return xsdDateTime.ToString(); }
protected static string TimeToString(DateTime value) { XsdDateTime time = new XsdDateTime(value, XsdDateTimeFlags.Time); return time.ToString(); }
protected static string GYearOffsetToString(DateTimeOffset value) { XsdDateTime time = new XsdDateTime(value, XsdDateTimeFlags.GYear); return time.ToString(); }
protected static string GYearMonthToString(DateTime value) { XsdDateTime time = new XsdDateTime(value, XsdDateTimeFlags.GYearMonth); return time.ToString(); }
protected static string GMonthDayToString(DateTime value) { XsdDateTime time = new XsdDateTime(value, XsdDateTimeFlags.GMonthDay); return time.ToString(); }