uncategorized

Ubuntu: change time zone

Recently, I always have work in Ubuntu servers. And sometimes when I tried to output a timestamp from server side to front end, I find something is “wrong”. Such I want time in EST, but the default is UTC.

In this case, there is a useful command in Ubuntu:

1
sudo dpkg-reconfigure tzdata

Then, you will see a list of country, choose the right one you need.

In my Java Project

Sometime, even I set time zone to ETS for Ubuntu server, I still get the time “wrong” in my Java Code. In this case, I just add

1
TimeZone.setDefault(TimeZone.getTimeZone("EST"));

in my Global Filter/handler.