Skip to Main Content

Embedded Technologies

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Get Java ME to print PST instead of GMT.

bjunttiNov 7 2014 — edited Nov 11 2014

I can get Java SE to print local TZ (PST) but I can't seem to get the same code to work on Java ME embedded.  Here's the code: (be gentle - I'm a Java neophyte :-) )

import java.util.TimeZone;

import java.util.Date;

import java.util.Calendar;

public class TZTest {

    public static void main(String args[]) {

        TimeZone tz = Calendar.getInstance().getTimeZone();

        Calendar now = Calendar.getInstance();

        now.setTimeZone(tz);

        System.out.println("Time and date: " + now.getTime());

    }

}

When I run that code in a midlet with Java ME (minus the 'main' of course) I get:

Starting emulator in execution mode

Time and date: Fri Nov 07 14:35:38 GMT-08:00 2014

The same thing happens using my Raspberry Pi as EmbeddedExternalDevice.  I tried it under Linux Ubuntu, and it prints out as PST.  What is going on?

How do I get PST?

Thanks for any help.  It's driving me bonkers.

Comments

karianna

This needs Stuart Marks to answer - I'll ping him over in OpenJDK.

3328368

Okay.  Thanks.  If you think I would do better posting this question someplace else, let me know.

karianna

OpenJDK core-libs mailing list might be a good place as well.

3328368

Thanks.  I reposted to core-libs-dev.

1 - 4
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Dec 9 2014
Added on Nov 7 2014
1 comment
930 views