Please attend new employee orientation training on "); HTMLfile.writeUTF("" + finalDate + " at 2 pm. in Room B3, which is above the cafeteria.
"); HTMLfile.writeUTF("We'll have a tee-shirt and cap and other corporate goodies for you at the training!
"); HTMLfile.writeUTF(""); HTMLfile.writeUTF(""); HTMLfile.close(); } catch (Exception e) { System.out.println ("Trouble with writing welcome page: " + e); } System.out.println("Exiting writeWelcomePage"); return fileName; } private String formatDateString (Date trainingDate){ System.out.println("Entering formatDateString"); String finalDay ="?"; try{ // Logic to rearrange date String // eg Mon Oct 16 2000 String dateStr = trainingDate.toString(); int strIndx = dateStr.indexOf("00:00"); String tmpDay1 = dateStr.substring(0, strIndx); int endIndx = dateStr.indexOf("2000"); String tmpDay2 = dateStr.substring(endIndx); finalDay = tmpDay1+ " " + tmpDay2; // 09:00:00 PDT/PST Remove PDT/PST String time = dateStr.substring(strIndx, endIndx); int i = time.indexOf("P"); time = time.substring(0, i); // end of string rearrangement logic } catch(Exception e){ System.out.println("Error : "+e); } System.out.println("Exiting formatDateString"); return finalDay; } public void destroy(){ } // helper functions to find training date private int IncrementForMonday(int thisDay, int dayOfMonth ){ if(thisDay == SUN) // for Monday just Increment Once from Sunday dayOfMonth = dayOfMonth+1; if(thisDay == TUE) // for Monday just Increment 6 from Tue dayOfMonth = dayOfMonth+6; if(thisDay == WED) // for Monday just Increment 5 from Wed dayOfMonth = dayOfMonth+5; if(thisDay == THU) // for Monday just Increment 4 from Thursday dayOfMonth = dayOfMonth+4; if(thisDay == FRI) // for Monday just Increment 3 from Friday dayOfMonth = dayOfMonth+3; if(thisDay == SAT) // for Monday just Increment 2 from Saturday dayOfMonth = dayOfMonth+2; return dayOfMonth; } private int IncrementForTuesday(int thisDay, int dayOfMonth ){ if(thisDay == SUN) dayOfMonth = dayOfMonth+2; if(thisDay == MON) dayOfMonth = dayOfMonth+1; if(thisDay == WED) dayOfMonth = dayOfMonth+6; if(thisDay == THU) dayOfMonth = dayOfMonth+5; if(thisDay == FRI) dayOfMonth = dayOfMonth+4; if(thisDay == SAT) dayOfMonth = dayOfMonth+3; return dayOfMonth; } private int IncrementForWednesday(int thisDay, int dayOfMonth ){ if(thisDay == SUN) dayOfMonth = dayOfMonth+3; if(thisDay == MON) dayOfMonth = dayOfMonth+2; if(thisDay == TUE) dayOfMonth = dayOfMonth+1; if(thisDay == THU) dayOfMonth = dayOfMonth+6; if(thisDay == FRI) dayOfMonth = dayOfMonth+5; if(thisDay == SAT) dayOfMonth = dayOfMonth+4; return dayOfMonth; } private int IncrementForThursday(int thisDay, int dayOfMonth ){ if(thisDay == SUN) dayOfMonth = dayOfMonth+4; if(thisDay == MON) dayOfMonth = dayOfMonth+3; if(thisDay == TUE) dayOfMonth = dayOfMonth+2; if(thisDay == WED) dayOfMonth = dayOfMonth+1; if(thisDay == FRI) dayOfMonth = dayOfMonth+6; if(thisDay == SAT) dayOfMonth = dayOfMonth+5; return dayOfMonth; } private int IncrementForFriday(int thisDay, int dayOfMonth ){ if(thisDay == SUN) dayOfMonth = dayOfMonth+5; if(thisDay == MON) dayOfMonth = dayOfMonth+4; if(thisDay == TUE) dayOfMonth = dayOfMonth+3; if(thisDay == WED) dayOfMonth = dayOfMonth+2; if(thisDay == THU) dayOfMonth = dayOfMonth+1; if(thisDay == SAT) dayOfMonth = dayOfMonth+6; return dayOfMonth; } private int IncrementForSaturday(int thisDay, int dayOfMonth ){ if(thisDay == SUN) dayOfMonth = dayOfMonth+6; if(thisDay == MON) dayOfMonth = dayOfMonth+5; if(thisDay == TUE) dayOfMonth = dayOfMonth+4; if(thisDay == WED) dayOfMonth = dayOfMonth+3; if(thisDay == THU) dayOfMonth = dayOfMonth+2; if(thisDay == FRI) dayOfMonth = dayOfMonth+1; return dayOfMonth; } private int IncrementForSunday(int thisDay, int dayOfMonth ){ if(thisDay == MON) dayOfMonth = dayOfMonth+6; if(thisDay == TUE) dayOfMonth = dayOfMonth+5; if(thisDay == WED) dayOfMonth = dayOfMonth+4; if(thisDay == THU) dayOfMonth = dayOfMonth+3; if(thisDay == FRI) dayOfMonth = dayOfMonth+2; if(thisDay == SAT) dayOfMonth = dayOfMonth+1; return dayOfMonth; } // end of class }