How to convert from Timestamp to Calendar?

Asked

Viewed 1,362 times

3

I need to convert a resultSet of the returning bank in Timestamp in a Calendar type variable.

1 answer

4


It is possible in Calendar you inform the team, which receives an instance of Date.

Like Timestamp is subclass of Date, you can do something like this:

public static Calendar timestampToCalendar(final Timestamp timestamp) {
    final Calendar cal = Calendar.getInstance();
    cal.setTime(timestamp);
    return cal;
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.