Comments (13)
If you see "in 23 hours" then probably the time you get from server is in the future. I can't think of any other explanation.
from android-ago.
@thamer898 You are responsible for ensuring that the value you pass to setReferenceTime()
is in the appropriate time zone. This library uses System.currentTimeMillis()
method to get the current time on the Android device and compare it against the reference time you passed it. Since System.currentTimeMillis()
is always in UTC time zone, you could try converting the time you get from your server into UTC (i.e., time since epoch) format and then passing it to setReferenceTime()
from android-ago.
@thamer898 You have 2 options:
- Your server always returns the time in UTC
- Your server returns time in whatever time zone it is in and in your app you convert it to UTC before setting it using
setReferenceTime
from android-ago.
@thamer898 could you provide some sample code?
from android-ago.
Hello
please see this code
//created at a value from server as an example it's value "2016-04-22T20:21:43.405Z"
RelativeTimeTextView v = (RelativeTimeTextView) convertView.findViewById(R.id.timestamp); //Or just use Butterknife!
v.setReferenceTime(createdAt.getTime());
Regards
from android-ago.
Hello
@curioustechizen any updates ?
Regards
from android-ago.
You'll have to provide a little more information I'm afraid. What did you expect the output to be? What was the actual time on the phone when you set the server time?
from android-ago.
Hello
this is the message delivery time from server : Sun Apr 24 23:01:18 EEST 2016
so i get the time by this variable long now = new Date().getTime();
after that this is the calculation method
String Date = DateUtils.getRelativeTimeSpanString(
createdAt.getTime(),
now,
DateUtils.SECOND_IN_MILLIS).toString();
Regards
from android-ago.
Hello
i want to display a message time like "just now" , 1 minute ago and so on .
Regards
from android-ago.
great what is the best time zone for my server that i should consider it ? kindly advice
from android-ago.
@curioustechizen thank you very much this is a problem from my server i change the time zone to be +3 and i solved the problem but how it will be for the countries for multiple time zones ?
from android-ago.
@curioustechizen right now am using a windows server 2012 r2 but right now am confused about the best time zone for different regions around the world do you have and advice about suitable time zone for that ?
from android-ago.
Hello @curioustechizen
Yes i saved a value as UTC in my server so is it fit all time zones ?
Regards
from android-ago.
Related Issues (20)
- Strings in Portuguese
- in 0 mins HOT 14
- Now LATEST_VERSION is what ? HOT 2
- Lack of consistent capitalization (English) HOT 3
- A String Completed added prior to time HOT 3
- Once the `UpdateTimeRunnable` is detached and the `weakRefRttv` cleared, it is never attached again HOT 4
- Add automated tests HOT 4
- Change lang of "hours ago" ... HOT 1
- Locale HOT 1
- Time is one hour behind on old Galaxy Tab 3 using Android 4.4.2 HOT 3
- add font family option HOT 6
- this work fine in recyclerviews? HOT 1
- Removing the "ago" word HOT 6
- Save timeago when close the app HOT 1
- Add a `getReferenceTime()` method
- Modify time update interval HOT 1
- Text format has extra charcters in it HOT 2
- Enhancement - short suffix HOT 1
- In new update, issue with Just Now
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-ago.