08-12-2008 05:43 AM
Hi Community
I have been looking for best practise to convert "tim" (Java statement below) in milli-seconds (since 1970 midnight) to human readable Date & Time.
I know roughly about SimpleDateFormat() but not sure how to implement it.
If anyone knows or can provide a sample code that will be great.
****
String tim = Long.toString(l.getTimestamp()); // timestamp
****
Thanks in advance
Solved! Go to Solution.
08-12-2008 08:49 AM
08-12-2008 09:43 PM
Many Thanks for your reply.
I tried to use the above lines of code as it is and got few errors.
java:49: cannot find symbol
symbol : class SimpleDateFormat
location : class ................
.....................................
I also used
import net.rim.device.api.i18n.Format.*;
But I am still getting error. Pardon me for my inexpertese with Java.
Thanks again
08-12-2008 10:49 PM - edited 08-13-2008 12:27 PM
Let me ask seriously: Do you program w/o using the Javadocs? I can't even tie my shoes without looking at the Javadocs first - they're indispensable. If you open the Javadocs and browse through the alphabetical list of classes you'll find SimpleDateFormat in net.rim.device.api.i18n (Format isn't a package, it's a class so you shouldn't be trying to do a wildcard import with it).
import net.rim.device.api.i18n.SimpleDateFormat;
Even better, if you use Eclipse you can put your cursor on the SimpleDateFormat word and hit ctrl-shift-m and it will add the import for you. In NetBeans do ctrl-shift-i.
08-12-2008 11:28 PM
Sorry Richard, for not doing my homework. I did have a look at the java docs and with my limited knowledge in Java I did have
import net.rim.device.api.i18n.SimpleDateFormat.*;
But after looking at your reply I removed (.*) at the end of my import. Since all the imports in my code had .* at the end I assumed that as a syntax which wasnt true.
My Sincere Thanks!
Regards
Adi
08-13-2008 03:15 AM
if you use Eclipse you can put your cursor on the SimpleDateFormat word and hit ctrl-shift-m and it will add the import for you.
08-13-2008 04:59 AM
Thanks Simon
I am using JDE and probably would like to use eclipse down the track, as you descibed there are benifits in doing that.
08-13-2008 05:15 AM