08-12-2008 05:43 AM
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
But I am still getting error. Pardon me for my inexpertese with Java.
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).
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
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!
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 05:15 AM