My web server is in Us i am posting comment in India. I am storing comment time as server time. Instead of showing just now
it shows 6hr before
means there is difference of 6 hour between actual comment time and server time.
I am using Spring-MVC
on server side and cassandra
as DB Here is how i am taking time of a comment:
long commentTime = new Date().getTime()
here how i am displaying date
SimpleDateFormat sdf = new SimpleDateFormat("YYYY MM dd hh:mm:ss a");
lk=Long.parseLong("date in long as string");
myPageList.setCreatedOn(sdf.format(new Date(lk)));
What are the way to sync time between client and server ?