calculating time difference from facebook api
<p>I used the following code to convert facebook created time.But some times I am getting -73456 seconds,-40 seconds and sometimes wrong time.</p>

<p>I think there is timezone error in this,how to solve this</p>

<pre><code>    SimpleDateFormat formatter = getDateFormat();
                               ParsePosition pos = new ParsePosition(0);
                               long then = formatter.parse(getCreatedTime, pos).getTime();
                               long now = new Date().getTime();

                               long seconds = (now - then)/1000;
                               long minutes = seconds/60;
                               long hours = minutes/60;
                               long days = hours/24;

                               String friendly = null;
                               long num = 0;
                               if (days &gt; 0) {
                                   num = days;
                                   friendly = days + " day";
                               } else if (hours &gt; 0) {
                                   num = hours;
                                   friendly = hours + " hour";
                               } else if (minutes &gt; 0) {
                                   num = minutes;
                                   friendly = minutes + " minute";
                               } else {
                                   num = seconds;
                                   friendly = seconds + " second";
                               }
                               if (num &gt; 1) {
                                   friendly += "s";
                               }
                               String postTimeStamp =    friendly.toLowerCase() + " ago";
                               Log.e("date",postTimeStamp );
                               date.add(postTimeStamp);
</code></pre>

<p>Did I need to convert anything?</p>

<p>Thanks</p>
