i trying display current timestamp in log file timezone value. observe 2 different users in same location, timezone printed differently.
for 1 user, displayed hst zone id , other gmt.
this problem gmt happening in note 2 device , in note 4 there no problem.
below code how timestamp,
try { date date = new date(); dateformat df = new simpledateformat("mm/dd/yyyy z:hh:mm:ss a"); df.settimezone(timezone.getdefault()); currenttimestamp = df.format(date); } catch (exception e) { log.e("logger", "error in getcurrenttimestamp = " + e.getmessage(),e); }
what expecting this,
05/02/2015 hst:09:43:46
but in note 2 gives me,
gmt-10:00:09:43:46
i tried changing phone's default timezone still no luck.
can please explain
hst gmt-10 giving right time format different.
greenwich mean time 10 hours ahead of hawaii standard time 7:04 pm thursday, hawaii standard time (hst) 5:04 friday, greenwich mean time (gmt)
use use dateformat df = new simpledateformat("mm/dd/yyyy z:hh:mm:ss a", locale.us);
timezone name.
Comments
Post a Comment