JMS MapMessage

I want to get a date value from from the property field of a map message. Right now I am getting the time in long format like this:long modTime = obj.getLongProperty("time");Thanks
[208 byte] By [sana] at [2007-11-25 22:10:43]
# 1

Hi,

Assuming the long value 'modTime' is "milliseconds since January 1, 1970, 00:00:00

GMT", then you can create a Date object via:

import java.util.Date;

Dated = new Date(modTime);

You can print a user readable date via:

import java.text.DateFormat;

DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT,

DateFormat.MEDIUM);

Stringts = df.format(d); // d is Date from first code sample above

System.out.println("modTime is: " + ts);

hope this helps,

-isa

http://www.sun.com/software/products/message_queue/index.xml

isahashim at 2007-7-5 1:52:59 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...