android - Get days until date based on timezone on phone -


i´ve been trying figure out while can not wrap head around it. i´m working on android app , want display left specific date, , want number of days based on time zone have set on phone.

i have joda time in app , information have example:

2013-05-05 9.00pm time in pst (gmt-8) timezone, have no clue how , have searched both on google , can not clear answer.

edit

i managed solve problem code found here on so

string datestring = airdate + " " + airtime.touppercase();                  simpledateformat sourceformat = new simpledateformat("yyyy-mm-dd k:mma");                 sourceformat.settimezone(timezone.gettimezone("gmt-8"));                  date parsed;                  parsed = sourceformat.parse(datestring);                 timezone tz = timezone.getdefault();                 simpledateformat destformat = new simpledateformat("yyyy-mm-dd");                 destformat.settimezone(tz);                  result = destformat.format(parsed); 

however found out times first got isn´t correct , time zone in format gmt-5 +dst. , dont´t know +dst if setting time 20:00 , using gmt-5 in timezone.gettimezone time returned 22:00 "wrong" since live in sweden. appreciate this.

if settle string looks "in 2 days", should able use dateutils.getrelativetimespanstring().


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -