private DateTime ConvertToDateInTheCorrectFormat(string aDate, DateTimeFormatEnumeration dateTimeFormatEnumeration) { if (dateTimeFormatEnumeration == DateTimeFormatEnumeration.year_month_day) { return(this.GetDateInYearMonthDayFormat(aDate)); } else if (dateTimeFormatEnumeration == DateTimeFormatEnumeration.month_day_year) { return(this.GetDateInMonthDayYear(aDate)); } else if (dateTimeFormatEnumeration == DateTimeFormatEnumeration.day_month_year) { return(this.GetDateInDayMonthYear(aDate)); } else if (dateTimeFormatEnumeration == DateTimeFormatEnumeration.seconds_since_epoch) { return(this.GetDateGivenSecondsSinceEpoch(aDate)); } else if (dateTimeFormatEnumeration == DateTimeFormatEnumeration.win_filetime) { return(this.GetDateGivenWinFileTime(aDate)); } else { throw new NotSupportedException("The dateTimeFormat is not supported."); } }
private DateTime ConvertToDateInTheCorrectFormat(string aDate, DateTimeFormatEnumeration dateTimeFormatEnumeration) { if (dateTimeFormatEnumeration == DateTimeFormatEnumeration.year_month_day) return this.GetDateInYearMonthDayFormat(aDate); else if (dateTimeFormatEnumeration == DateTimeFormatEnumeration.month_day_year) return this.GetDateInMonthDayYear(aDate); else if (dateTimeFormatEnumeration == DateTimeFormatEnumeration.day_month_year) return this.GetDateInDayMonthYear(aDate); else if (dateTimeFormatEnumeration == DateTimeFormatEnumeration.seconds_since_epoch) return this.GetDateGivenSecondsSinceEpoch(aDate); else if (dateTimeFormatEnumeration == DateTimeFormatEnumeration.win_filetime) return this.GetDateGivenWinFileTime(aDate); else throw new NotSupportedException("The dateTimeFormat is not supported."); }
/// <summary> /// Gets the date in format specified in the definitions document. /// the formats are defined in DateTimeFormatEnumeration /// </summary> /// <param name="aDate">A date.</param> /// <param name="dateTimeFormatEnumeration">The date time format enumeration.</param> /// <returns></returns> public DateTime GetDateInFormat(string aDate, DateTimeFormatEnumeration dateTimeFormatEnumeration) { try { return ConvertToDateInTheCorrectFormat(aDate, dateTimeFormatEnumeration); } catch (NotSupportedException e) { throw e; } catch (Exception e) { throw new InvalidCastException(string.Format("The value {0} is not a date.", aDate), e); } }
/// <summary> /// Gets the date in format specified in the definitions document. /// the formats are defined in DateTimeFormatEnumeration /// </summary> /// <param name="aDate">A date.</param> /// <param name="dateTimeFormatEnumeration">The date time format enumeration.</param> /// <returns></returns> public DateTime GetDateInFormat(string aDate, DateTimeFormatEnumeration dateTimeFormatEnumeration) { try { return(ConvertToDateInTheCorrectFormat(aDate, dateTimeFormatEnumeration)); } catch (NotSupportedException e) { throw e; } catch (Exception e) { throw new InvalidCastException(string.Format("The value {0} is not a date.", aDate), e); } }
public TimeDifferenceFunctionType() { this.format_1Field = DateTimeFormatEnumeration.year_month_day; this.format_2Field = DateTimeFormatEnumeration.year_month_day; }
public OvalTimeDifferenceBuilder WithSecondFormat(DateTimeFormatEnumeration format) { this.timeDifference.format_2 = format; return this; }
public OvalTimeDifferenceBuilder WithSecondFormat(DateTimeFormatEnumeration format) { this.timeDifference.format_2 = format; return(this); }