/// <summary> /// Ported from format_datetime /// </summary> public string FormatDateTime(DateTime when, FormatTypeEnum formatType = FormatTypeEnum.FMT_PRINTED, string format = null) { if (formatType == FormatTypeEnum.FMT_WRITTEN) { return(WrittenDateTimeIO.Format(when)); } else if (formatType == FormatTypeEnum.FMT_CUSTOM && format != null) { DateTimeIO dateIO; if (TempDateTimeIO.TryGetValue(format, out dateIO)) { return(dateIO.Format(when)); } else { dateIO = new DateTimeIO(format, false); TempDateTimeIO.Add(format, dateIO); return(dateIO.Format(when)); } } else if (formatType == FormatTypeEnum.FMT_PRINTED) { return(PrintedDateTimeIO.Format(when)); } throw new InvalidOperationException("formatter"); }
public void SetDateTimeFormat(string format) { WrittenDateTimeIO.SetFormat(format); PrintedDateTimeIO.SetFormat(format); }