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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -