示例#1
0
 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.");
     }
 }
示例#2
0
 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.");
 }
示例#3
0
 /// <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);
     }
 }
示例#4
0
 /// <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);
     }
 }
示例#5
0
 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;
 }
示例#7
0
 public OvalTimeDifferenceBuilder WithSecondFormat(DateTimeFormatEnumeration format)
 {
     this.timeDifference.format_2 = format;
     return(this);
 }