java - Convert UTC Date to local Date -
i converting epoch time (which in utc) format shown below. tried different answers convert utcdate
utc
local time. not getting local time.
any appreciated.
string epochtime = "1436831775043"; date utcdate = new date(long.parselong(epochtime)); date localdate; // how this? simpledateformat simpledateformat = new simpledateformat("h:mm a"); string result = simpledateformat.format(utcdate);
also, conversion has done without of external library.
you can set time zone in formatter:
simpledateformat.settimezone(timezone.getdefault());
Comments
Post a Comment