Hello.
I have a Timestamp field I am obtaining from my DB. I need to format this field in CCYYMMDD format. This is not my problem. I extract the year, month, and day fields from the Timestamp instance using the Timestamp (inherited from superclass Date) getYear(), getMonth(), and getDate() functions.
However, these methods are giving me deprecation warnings. When consulting the JDK API, I see that the use of Calendar.get(Calendar.YEAR) - 1900 is recommended for obtaining the year, and similar Calendar get() calls for the other fields.
However, there is no constructor for the concrete class GregorianCalendar given a Date or Timestamp object. In order to construct an instance, I must provide the year, month, and day values in the constructor. This does me no good. Am I missing something here?
How can I retrieve the year, month, and day values from a Timestamp instance without getting deprecation warnings? That is the question.
Thanks everyone.
Dan
I have a Timestamp field I am obtaining from my DB. I need to format this field in CCYYMMDD format. This is not my problem. I extract the year, month, and day fields from the Timestamp instance using the Timestamp (inherited from superclass Date) getYear(), getMonth(), and getDate() functions.
However, these methods are giving me deprecation warnings. When consulting the JDK API, I see that the use of Calendar.get(Calendar.YEAR) - 1900 is recommended for obtaining the year, and similar Calendar get() calls for the other fields.
However, there is no constructor for the concrete class GregorianCalendar given a Date or Timestamp object. In order to construct an instance, I must provide the year, month, and day values in the constructor. This does me no good. Am I missing something here?
How can I retrieve the year, month, and day values from a Timestamp instance without getting deprecation warnings? That is the question.
Thanks everyone.
Dan