01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05:
06: package com.sun.portal.search.util;
07:
08: import java.util.*;
09: import java.text.*;
10: import java.io.*;
11:
12: /**
13: *
14: */
15: public class TestDateParser {
16:
17: public static void main(String[] args) {
18: String[] testDates = { "Sat Jan 11 07:06:18 PST 1997",
19: "Sat, 11 Jan 1997 07:06:18 GMT",
20: "Sat, 11 Jan 1997 07:06:18", "10/1/99 1:2:3",
21: "10/1/99 13:23:47", "10/1/99", "10.1.99 1:2:3",
22: "10.1.99 13:23:47", "10.1.99", "10-1-99 1:2:3",
23: "10-1-99 13:23:47", "10-1-99", "1/1/1970", "1/1/70",
24: "1/1/69", "1/1/15", "1/1/2000 GMT", "1/1/2000 PST",
25: "1/1/2000", "1/1/00", "25/12/99", "12/25/99",
26: "Wed, July 10, '96", "12:08 PM",
27: "12 o'clock PM, Pacific Daylight Time", "0:00 PM, PST",
28: "1996.July.10 AD 12:08 PM",
29: "Tue Aug 29 12:19:28 EDT 2000", "Fri, June 21 2002",
30: "Fri, June 21 2002 15:33:52 GMT",
31: "fri,31 Dec 1990 10:00:00 GMT", "31-Dec-2002",
32: "Monday, 17-Jun-2002 13:16:30 JST",
33: "Thu Sep 20 15:38:45 2001 JST",
34: "Fri Feb 18 01:34:46 2000 JST", "23 11 1998",
35: "23 11 98", "11 23 1998", "11 23 98", "1998 18 11",
36: "1998 11 18", "1992-12-15", "12-15-1992", "now",
37: "today", "immediately", "expired", "never", "0", "+1",
38: "+100", "-1", "-100",
39: "Tuesday, February 03, 2004 10:41:59 GMT", };
40: //System.out.println(DateFormat.getAvailableLocales());
41: for (int i = 0; i < testDates.length; ++i) {
42: System.out.print(testDates[i] + " -> ");
43: try {
44: System.out.println(DateParser.parse(testDates[i]));
45: } catch (Exception e) {
46: System.out.println(e);
47: }
48: }
49: }
50:
51: }
|