So I'm kinda new to the Calendar/Time/Date stuff in Java but I've read a lot about them on the net.
Here is what I have to do:
I have an external device which sends an Avl Data Packet to my Communication Server and I'm on the parsing process of the Data part.
Somewhere in the Data Packet the device sends a timestamp of 32 bits which I have to parse/translate into the time the Record of the point from the GPS was saved.
The timestamp gives me seconds from 2007.01.01 00:00 UTC
Now here is a sample code that I felt that was the closest one I tried of the rest of the experiments..
DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss.SSS");
long now = (long)(TimeStampSeconds.longValue() * 1000);
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(2007, 0, 1);
calendar.setTimeInMillis(now);
System.out.println(now + " = " + formatter.format(calendar.getTime()));
After that I found out that the calendar.set doesnt make a new epoch and so the .setTimeInMills doesnt work.Though I get some crazy results like:
Binary Timestamp is : 0000101011000001010110001111011100001111
SECONDS: 46193506063
46193506063000 = 25/10/3433 04:27:43.000
Shouldn't I just be missing just the 37 years between 1970 and 2007??
I want to find a way of finding the time from the seconds I get from the device but they have epoch 1/1/2007 and java has epoch 1/1/1970..
EDIT: What I want is to have time:1/1/2007 PLUS the timestamp's time. Hope I clarified the question a bit..
Someone any ideas?? Thx in Advance