cancel
Showing results for 
Search instead for 
Did you mean: 

How to set TimeZone?

Former Member
0 Kudos

Hi All,

Could you please tell me how to set the time zone. For example If I want to Set time Zone for a user to 'GMT+01:00 (Africa/Malabo) Western African Time' , How to do it?. I am trying the bellow code, but its not working. Can some modify it?

String Uid = "USER.PRIVATE_DATASOURCE.un:test1";

IUserMaint us = UMFactory.getUserFactory().getMutableUser(Uid);

String tz="GMT+01:00 (Africa/Malabo) Western African Time";

final TimeZone tz = TimeZone.getTimeZone(tzString);

us.setTimeZone(tz);

us.save();

us.commit();

The above code is saving only in GMT (as UK is local county for me), but I want to set it to timezone -->GMT+01:00 (Africa/Malabo) Western African Time.

PL: Points will be awarded for right answer. Help please

Regards

Maruti

Accepted Solutions (1)

Accepted Solutions (1)

former_member182294
Active Contributor
0 Kudos

Hi Maruti,

Use following format:

final TimeZone tz = TimeZone.getTimeZone("Africa/Malabo");

If you want to specify specific time then use <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/SimpleTimeZone.html">SimpleTimeZone</a>.

Regards

Abhilash

Former Member
0 Kudos

Hi Abhilash,

Thanks. It works.

Answers (0)