l = new Label(2, 1, "Custom formats");
s.addCell(l);
WritableCellFormat cf1 = new WritableCellFormat(DateFormats.FORMAT1);
DateTime dt = new DateTime(0,2,date, cf1, DateTime.GMT);
s.addCell(dt);
cf1 = new WritableCellFormat(DateFormats.FORMAT2);
dt = new DateTime(0,3,date, cf1,DateTime.GMT);
s.addCell(dt);
cf1 = new WritableCellFormat(DateFormats.FORMAT3);
dt = new DateTime(0,4,date, cf1);
s.addCell(dt);
cf1 = new WritableCellFormat(DateFormats.FORMAT4);
dt = new DateTime(0,5,date, cf1);
s.addCell(dt);
cf1 = new WritableCellFormat(DateFormats.FORMAT5);
dt = new DateTime(0,6,date, cf1);
s.addCell(dt);
cf1 = new WritableCellFormat(DateFormats.FORMAT6);
dt = new DateTime(0,7,date, cf1);
s.addCell(dt);
cf1 = new WritableCellFormat(DateFormats.FORMAT7);
dt = new DateTime(0,8,date, cf1, DateTime.GMT);
s.addCell(dt);
cf1 = new WritableCellFormat(DateFormats.FORMAT8);
dt = new DateTime(0,9,date, cf1, DateTime.GMT);
s.addCell(dt);
cf1 = new WritableCellFormat(DateFormats.FORMAT9);
dt = new DateTime(0,10,date, cf1, DateTime.GMT);
s.addCell(dt);
cf1 = new WritableCellFormat(DateFormats.FORMAT10);
dt = new DateTime(0,11,date, cf1, DateTime.GMT);
s.addCell(dt);
cf1 = new WritableCellFormat(DateFormats.FORMAT11);
dt = new DateTime(0,12,date, cf1, DateTime.GMT);
s.addCell(dt);
cf1 = new WritableCellFormat(DateFormats.FORMAT12);
dt = new DateTime(0,13,date, cf1, DateTime.GMT);
s.addCell(dt);
// Custom formats
DateFormat df = new DateFormat("dd MM yyyy");
cf1 = new WritableCellFormat(df);
l = new Label(2, 2, "dd MM yyyy");
s.addCell(l);
dt = new DateTime(3, 2, date, cf1, DateTime.GMT);
s.addCell(dt);
df = new DateFormat("dd MMM yyyy");
cf1 = new WritableCellFormat(df);
l = new Label(2, 3, "dd MMM yyyy");
s.addCell(l);
dt = new DateTime(3, 3, date, cf1, DateTime.GMT);
s.addCell(dt);
df = new DateFormat("hh:mm");
cf1 = new WritableCellFormat(df);
l = new Label(2, 4, "hh:mm");
s.addCell(l);
dt = new DateTime(3, 4, date, cf1, DateTime.GMT);
s.addCell(dt);
df = new DateFormat("hh:mm:ss");
cf1 = new WritableCellFormat(df);
l = new Label(2, 5, "hh:mm:ss");
s.addCell(l);
dt = new DateTime(3, 5, date, cf1, DateTime.GMT);
s.addCell(dt);
df = new DateFormat("H:mm:ss a");
cf1 = new WritableCellFormat(df);
l = new Label(2, 5, "H:mm:ss a");
s.addCell(l);
dt = new DateTime(3, 5, date, cf1, DateTime.GMT);
s.addCell(dt);
dt = new DateTime(4, 5, date13, cf1, DateTime.GMT);
s.addCell(dt);
df = new DateFormat("mm:ss.SSS");
cf1 = new WritableCellFormat(df);
l = new Label(2, 6, "mm:ss.SSS");
s.addCell(l);
dt = new DateTime(3, 6, date, cf1, DateTime.GMT);
s.addCell(dt);
df = new DateFormat("hh:mm:ss a");
cf1 = new WritableCellFormat(df);
l = new Label(2, 7, "hh:mm:ss a");
s.addCell(l);
dt = new DateTime(4, 7, date13, cf1, DateTime.GMT);
s.addCell(dt);
// Check out the zero date ie. 1 Jan 1900
l = new Label(0,16,"Zero date " + sdf.format(date2),
wrappedText);
s.addCell(l);
cf1 = new WritableCellFormat(DateFormats.FORMAT9);
dt = new DateTime(0,17,date2, cf1, DateTime.GMT);
s.addCell(dt);
// Check out the zero date + 1 ie. 2 Jan 1900
l = new Label(3,16,"Zero date + 1 " + sdf.format(date5),
wrappedText);
s.addCell(l);
cf1 = new WritableCellFormat(DateFormats.FORMAT9);
dt = new DateTime(3,17,date5, cf1, DateTime.GMT);
s.addCell(dt);
// Check out the 1 Jan 1901
l = new Label(3,19, sdf.format(date6),
wrappedText);
s.addCell(l);
cf1 = new WritableCellFormat(DateFormats.FORMAT9);
dt = new DateTime(3,20,date6, cf1, DateTime.GMT);
s.addCell(dt);
// Check out the 31 May 1900
l = new Label(3,22, sdf.format(date7),
wrappedText);
s.addCell(l);
cf1 = new WritableCellFormat(DateFormats.FORMAT9);
dt = new DateTime(3,23, date7, cf1, DateTime.GMT);
s.addCell(dt);
// Check out 1 Feb 1900
l = new Label(3,25, sdf.format(date8),
wrappedText);
s.addCell(l);
cf1 = new WritableCellFormat(DateFormats.FORMAT9);
dt = new DateTime(3,26, date8, cf1, DateTime.GMT);
s.addCell(dt);
// Check out 31 Jan 1900
l = new Label(3,28, sdf.format(date9),
wrappedText);
s.addCell(l);
cf1 = new WritableCellFormat(DateFormats.FORMAT9);
dt = new DateTime(3,29, date9, cf1, DateTime.GMT);
s.addCell(dt);
// Check out 31 Jan 1900
l = new Label(3,28, sdf.format(date9),
wrappedText);
s.addCell(l);
cf1 = new WritableCellFormat(DateFormats.FORMAT9);
dt = new DateTime(3,29, date9, cf1, DateTime.GMT);
s.addCell(dt);
// Check out 1 Mar 1900
l = new Label(3,31, sdf.format(date10),
wrappedText);
s.addCell(l);
cf1 = new WritableCellFormat(DateFormats.FORMAT9);
dt = new DateTime(3,32, date10, cf1, DateTime.GMT);
s.addCell(dt);
// Check out 27 Feb 1900
l = new Label(3,34, sdf.format(date11),
wrappedText);
s.addCell(l);
cf1 = new WritableCellFormat(DateFormats.FORMAT9);
dt = new DateTime(3,35, date11, cf1, DateTime.GMT);
s.addCell(dt);
// Check out 28 Feb 1900
l = new Label(3,37, sdf.format(date12),
wrappedText);
s.addCell(l);
cf1 = new WritableCellFormat(DateFormats.FORMAT9);
dt = new DateTime(3,38, date12, cf1, DateTime.GMT);
s.addCell(dt);
// Check out the zero date ie. 1 Jan 1970
l = new Label(0,19,"Zero UTC date " + sdf.format(date3),
wrappedText);
s.addCell(l);
cf1 = new WritableCellFormat(DateFormats.FORMAT9);
dt = new DateTime(0,20,date3, cf1, DateTime.GMT);
s.addCell(dt);
// Check out the WWI armistice day ie. 11 am, Nov 11, 1918
l = new Label(0,22,"Armistice date " + sdf.format(date4),
wrappedText);
s.addCell(l);
cf1 = new WritableCellFormat(DateFormats.FORMAT9);
dt = new DateTime(0,23,date4, cf1, DateTime.GMT);
s.addCell(dt);
// Check out the Battle of Hastings date Oct 14th, 1066
l = new Label(0,25, "Battle of Hastings " + sdf.format(date14),
wrappedText);
s.addCell(l);
cf1 = new WritableCellFormat(DateFormats.FORMAT2);
dt = new DateTime(0, 26, date14, cf1, DateTime.GMT);
s.addCell(dt);
}