protected override void WriteJsonImpl(JsonWriter writer, OffsetDateTime value, JsonSerializer serializer) { if (writer is null) { throw new ArgumentNullException(nameof(writer)); } writer.WriteValue(_pattern.Format(value)); }
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string)) { return(_pattern.Format((OffsetDateTime)value)); } if (destinationType == typeof(DateTimeOffset)) { return(((OffsetDateTime)value).ToDateTimeOffset()); } return(base.ConvertTo(context, culture, value, destinationType)); }
public void FormatWithNumbersToSecond() { PatternWithNumbersToSecond.Format(SampleOffsetDateTime); }
public static string FormatFileName(OffsetDateTime date) { return(OffsetDatePattern.Format(date)); }