Back to project page RavenChat.
The source code is released under:
Copyright (c) 2014 Sumit Gouthaman. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Softwar...
If you think the Android project RavenChat listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.sumitgouthaman.raven.utils; //from www.j a v a2s . c om import android.text.format.DateUtils; /** * Created by sumit on 4/4/14. */ /** * Class to format the timestamp displayed on messages */ public class TimestampFormatter { /** * Convert from a regular timestamp to a String with relative time. * Eg: 1 sec ago, 1 day ago, etc. * @param timestamp - The time stamp to convert * @return */ public static String getAppropriateFormat(long timestamp) { String str = ""; long now = System.currentTimeMillis(); str = "" + DateUtils.getRelativeTimeSpanString(timestamp, now, 0); return str; } }