Dates in Java

how to get a non-deprecated time in java:

Date dateFromMessage = new Date(msg.getTimeAsMillis());
String expectedDateString = “1/19/05 2:50 PM”;

DateFormat d1 = DateFormat.getInstance();
d1.setTimeZone(TimeZone.getTimeZone(“America/Los_Angeles”));

String dateFromMessageAsString = d1.format(dateFromMessage);

dtm.publishSubtestResult(
dateFromMessageAsString.equals(expectedDateString),
dateFromMessageAsString + ” == ” + expectedDateString
);