} //end method /// <summary> Returns a string value representing the input Gregorian Calendar object in /// an Hl7 Date Format. /// </summary> public static System.String toHl7DTFormat(System.Globalization.GregorianCalendar cal) { System.String val = ""; try { //set the input cal object so that it can report errors //on it's value int calYear = SupportClass.CalendarManager.manager.Get(cal, SupportClass.CalendarManager.YEAR); int calMonth = SupportClass.CalendarManager.manager.Get(cal, SupportClass.CalendarManager.MONTH) + 1; int calDay = SupportClass.CalendarManager.manager.Get(cal, SupportClass.CalendarManager.DAY_OF_MONTH); CommonDT dt = new CommonDT(); dt.setYearMonthDayPrecision(calYear, calMonth, calDay); val = dt.Value; } //end try catch (DataTypeException e) { throw e; } //end catch catch (System.Exception e) { throw new DataTypeException(e); } //end catch return(val); } //end method
} //end constructor /// <summary> This method takes in integer values for the year and month and day /// and performs validations, it then sets the value in the object /// formatted as an HL7 Time Stamp value with year&month&day precision (YYYYMMDD). /// /// </summary> public virtual void setDatePrecision(int yr, int mnth, int dy) { try { //create date object if there isn't one if (dt == null) { dt = new CommonDT(); } //set the value of the date object to the input date value dt.setYearMonthDayPrecision(yr, mnth, dy); //clear the time value object tm = null; } //end try catch (DataTypeException e) { throw e; } //end catch catch (System.Exception e) { throw new DataTypeException(e); } //end catch } //end method
} //end method /// <summary> Returns a string value representing the input Gregorian Calendar object in /// an Hl7 Date Format. /// </summary> public static System.String toHl7DTFormat(System.Globalization.GregorianCalendar cal) { System.String val = ""; try { //set the input cal object so that it can report errors //on it's value int calYear = SupportClass.CalendarManager.manager.Get(cal, SupportClass.CalendarManager.YEAR); int calMonth = SupportClass.CalendarManager.manager.Get(cal, SupportClass.CalendarManager.MONTH) + 1; int calDay = SupportClass.CalendarManager.manager.Get(cal, SupportClass.CalendarManager.DAY_OF_MONTH); CommonDT dt = new CommonDT(); dt.setYearMonthDayPrecision(calYear, calMonth, calDay); val = dt.Value; } //end try catch (DataTypeException e) { throw e; } //end catch catch (System.Exception e) { throw new DataTypeException(e); } //end catch return val; } //end method