View Javadoc

1   // Copyright 2006-2007, by the California Institute of Technology.
2   // ALL RIGHTS RESERVED. United States Government Sponsorship acknowledged.
3   // Any commercial use must be negotiated with the Office of Technology Transfer
4   // at the California Institute of Technology.
5   //
6   // This software is subject to U. S. export control laws and regulations
7   // (22 C.F.R. 120-130 and 15 C.F.R. 730-774). To the extent that the software
8   // is subject to U.S. export control laws and regulations, the recipient has
9   // the responsibility to obtain export licenses or other export authority as
10  // may be required before exporting such information to foreign countries or
11  // providing access to foreign nationals.
12  //
13  // $Id: DateTime.java 3360 2008-07-16 18:47:08Z pramirez $ 
14  //
15  
16  package gov.nasa.pds.tools.label;
17  
18  import gov.nasa.pds.tools.dict.type.Types;
19  
20  import java.text.ParseException;
21  import java.util.Date;
22  
23  /***
24   * @author pramirez
25   * @version $Revision: 3360 $
26   * 
27   */
28  public class DateTime extends Scalar implements Types {
29      private Date date;
30      
31      /***
32       * @param value
33       */
34      public DateTime(String value) throws ParseException {
35          super(value);
36          date = DateTimeFormatter.parse(value);
37      }
38      
39      public DateTime(Date date) {
40          super(date.toString());
41          this.date = date;
42      }
43      
44      public Date getDate() {return date;}
45  
46  	public boolean isSupportedPDSType(String type) {
47  		if (Types.DATE.equals(type) || Types.TIME.equals(type))
48  			return true;
49  		return false;
50  	}
51  
52  }