android-dateutils


How to use DateUtils#getRelativeDateTimeString to print relative time for specific use?


How to use the DateUtils methods to get the relative timing. Precisely, "yesterday, 12:13 PM" but the relative timing yesterday is shown if the event time and the current time difference is 24 hrs.
In my case if the event time is 2016-07-04 21:08:30 and current time is 2016-07-05 21:00:00 the result shows "yesterday". but if I change the event time to be 2016-07-04 20:08:30 (more than 24hrs diff) then it shows 4 Jul, 9:08 PM
Want the relative time to be yesterday on both the cases. How do I achieve that?
CharSequence cs = DateUtils.getRelativeDateTimeString(
context,
sdf.parse(model.getDate()).getTime(),
DateUtils.MINUTE_IN_MILLIS,
DateUtils.DAY_IN_MILLIS,
DateUtils.FORMAT_NUMERIC_DATE
);
This is the code snippet I've used to get the above explained case.

Related Links

How to use DateUtils#getRelativeDateTimeString to print relative time for specific use?

Categories

HOME
facebook-oauth
ng-idle
dns
google-spreadsheet
twig
swt
gradient
static-site
scripting
google-apps
emscripten
3d-reconstruction
onclick
maxscript
echo
nuget-package
iis-6
dkim
reactive-programming
endeca
openpyxl
why3
line
onedrive-api
altera
red5
foreign-keys
asp.net-core-webapi
ksh
springfox
react-toolbox
exploit
tosca
displaytag
direct3d11
data.stackexchange.com
onload
itunes
fragment-backstack
linked-data
eviews
xbox
utorrent
installshield-le
installscript
python-pptx
apic
wurfl
filesystemwatcher
gdata
health-monitoring
oracle-service-bus
avcapturedevice
uiimage
mongotemplate
opengl-4
rsa-archer-grc
polyline
cronexpression
webjars
async.js
project-organization
html-to-pdf
state-restoration
roadkill-wiki
ess
toolkit
skspritenode
cwrsync
xmltype
at-job
packet-sniffers
imagefilter
buffering
websphere-esb
openargs
windows-phone-8-sdk
kogrid
asdf
server-administration
failing-tests
event-receiver
luajava
strtod
silverlight-oob
interop-domino
windows-identity
alsb
int64
mathematical-typesetting

Resources

Encrypt Message