get formatted date and time in android
<p>i have two function to calculate date and time.</p>

<pre><code>  public static String getFormattedDate(String time) {
    long timeUnix = Long.parseLong(time);
    Date myDate = new Date(timeUnix * 1000);
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMM d yy");
    return simpleDateFormat.format(myDate);
}

  public static String getFormattedTime(String time) {
    long timeUnix = Long.parseLong(time);
    Date myDate = new Date(timeUnix * 1000);
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("hh:mm:ss");
    return simpleDateFormat.format(myDate);
}
</code></pre>

<p>i get the right output from them which i need.</p>

<pre><code>Jul 12 11(date function) and 12:09:45(time function)
</code></pre>

<p>how does i calculate days from this and how to set am/pm with this.</p>

<p>i  am trying to set time with am/pm if it is today's date and if it is older than show the day(mon,tue,wed etc.)and if it is more than week old than show "MMM d yy".</p>

<p>Thanks</p>
