public MonthDateFormat(TimeZone zone, Locale locale, int chars, bool showYearForJan, bool showYearForDec) { int num1 = showYearForJan ? 1 : 0; int num2 = showYearForDec ? 1 : 0; TimeZone zone1 = zone; Locale locale1 = locale; int chars1 = chars; bool[] showYear = new bool[13]; int index1 = 0; int num3 = num1; showYear[index1] = num3 != 0; int index2 = 1; int num4 = 0; showYear[index2] = num4 != 0; int index3 = 2; int num5 = 0; showYear[index3] = num5 != 0; int index4 = 3; int num6 = 0; showYear[index4] = num6 != 0; int index5 = 4; int num7 = 0; showYear[index5] = num7 != 0; int index6 = 5; int num8 = 0; showYear[index6] = num8 != 0; int index7 = 6; int num9 = 0; showYear[index7] = num9 != 0; int index8 = 7; int num10 = 0; showYear[index8] = num10 != 0; int index9 = 8; int num11 = 0; showYear[index9] = num11 != 0; int index10 = 9; int num12 = 0; showYear[index10] = num12 != 0; int index11 = 10; int num13 = 0; showYear[index11] = num13 != 0; int index12 = 11; int num14 = 0; showYear[index12] = num14 != 0; int index13 = 12; int num15 = num2; showYear[index13] = num15 != 0; SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yy"); // ISSUE: explicit constructor call this.\u002Ector(zone1, locale1, chars1, showYear, (DateFormat) simpleDateFormat); }
/// <summary> /// Set up a 24 hour calendar /// </summary> /// <param name="calendar"></param> private void SetupCalendar(ProjectCalendar calendar) { // Simple date format for setting dates SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); // Date range containing all hours DateRange range = new DateRange(format.parse("2000-01-01 00:00"), format.parse("2000-01-02 00:00")); // Set calendar name to the same value to which the project calendar will be set calendar.Name = PROJECT_CALENDER_NAME; // Mark each day as working calendar.setWorkingDay(Day.SUNDAY, true); calendar.setWorkingDay(Day.MONDAY, true); calendar.setWorkingDay(Day.TUESDAY, true); calendar.setWorkingDay(Day.WEDNESDAY, true); calendar.setWorkingDay(Day.THURSDAY, true); calendar.setWorkingDay(Day.FRIDAY, true); calendar.setWorkingDay(Day.SATURDAY, true); // Add a working hours range to each day ProjectCalendarHours hours; hours = calendar.addCalendarHours(Day.SUNDAY); hours.addRange(range); hours = calendar.addCalendarHours(Day.MONDAY); hours.addRange(range); hours = calendar.addCalendarHours(Day.TUESDAY); hours.addRange(range); hours = calendar.addCalendarHours(Day.WEDNESDAY); hours.addRange(range); hours = calendar.addCalendarHours(Day.THURSDAY); hours.addRange(range); hours = calendar.addCalendarHours(Day.FRIDAY); hours.addRange(range); hours = calendar.addCalendarHours(Day.SATURDAY); hours.addRange(range); }
/// <summary> /// Takes a list of attributes from a dPOW object and tries to parse the value of the given key into a date /// </summary> /// <param name="attributesList">List of attributes in dPOW object</param> /// <param name="key">Key to return the parsed value of</param> /// <param name="defaultValue">Value to return if date cannot be found or parsed</param> /// <returns>Date object or defaultValue if date could not be found or parsed</returns> private static java.util.Date DateFromAttributes(List<Xbim.DPoW.Attribute> attributesList, string key, Date defaultValue) { // Search the attributes list for an attribute matching the given key if(attributesList.Any(a => a.Name == key)) { // Attempt to parse a date from the value DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); try { return format.parse(attributesList.First(a => a.Name == key).Value); } catch(System.Exception e) { return defaultValue; } } return defaultValue; }
public ConsoleLogFormatter() { dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); }