1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
private static void testDate() { System.out.printf("%tc\n",new Date()); System.out.printf("%tF\n",new Date()); System.out.printf("%tD\n",new Date()); System.out.printf("%tT\n",new Date()); System.out.printf("%tr\n",new Date()); System.out.printf("%tR\n",new Date()); System.out.printf("%tY\n",new Date()); System.out.printf("%ty\n",new Date()); System.out.printf("%tC\n",new Date()); System.out.printf("%tb\n",new Date()); System.out.printf("%tB\n",new Date()); System.out.printf("%tm\n",new Date()); System.out.printf("%td\n",new Date()); System.out.printf("%te\n",new Date()); System.out.printf("%tA\n",new Date()); System.out.printf("%ta\n",new Date()); System.out.printf("%tj\n",new Date()); System.out.printf("%tH\n",new Date()); System.out.printf("%tk\n",new Date()); System.out.printf("%tI\n",new Date()); System.out.printf("%tl\n",new Date()); System.out.printf("%tM\n",new Date()); System.out.printf("%tS\n",new Date()); System.out.printf("%tL\n",new Date()); System.out.printf("%tN\n",new Date()); System.out.printf("%tp\n",new Date());
System.out.printf("%tz\n",new Date()); System.out.printf("%tZ\n",new Date()); System.out.printf("%ts\n",new Date()); System.out.printf("%tQ\n",new Date());
String fullDate = String.format("%1$s%2$tY-%2$tm-%2$td %2$tT", "Due Date: ", new Date()); String fullDate2 = String.format("%s%tY-%<tm-%<td %<tT", "Due Date: ", new Date()); String fullDate3 = String.format("%s%tF %<tT", "Due Date: ", new Date()); System.out.println(fullDate); System.out.println(fullDate2); System.out.println(fullDate3); }
|