How to convert Timezone into specified formate?

By unamepwd786 ·
Actually my java code like this.....
SimpleDateFormat sourceFormat = new SimpleDateFormat("z");
SimpleDateFormat gmtFormat = new SimpleDateFormat("'GMT('Z')'");
date1 = gmtFormat.format(sourceFormat.parse("IST"));

O/p:GMT(+0530) for example we are passing "PST" it will show GMT(-0800) but my example will show always GMT(+0530)....

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Note that you have uppercase and lowercase Z

by robo_dev In reply to How to convert Timezone i ...

Those are not the same variables, JAVA is case sensitive

If a substitution variable is not working, two thoughts:

Is the variable declared properly?
Insert some code to display the variable value to make sure the value is what you expect.

Related Discussions

Related Forums