Change displayed time zone within a JSpinner - Help!

Hi,
I have a JSpinner formated to use a date model. The format of the text displayed includes the time zone. The time zone displayed is my local time zone and I would like it to be a different time zone (Etc/UTC). I have tried setting the time zone of date the spinner is intialized with as well as the SimpleDateFormat string passed into the editor, but the spinner still displays the local time zone. I have been searching online and in the forums and while I've found lots of issues with using the date model spinner, I haven't found this particular issue. Any help is greatly appreciated!!
Here is my code:
// Save off the current date and time
GregorianCalendar now = new GregorianCalendar();
// Set the timezone to be UTC
now.setTimeZone(TimeZone.getTimeZone("Etc/UTC"));
// Create a date/time spinner with a default value of the current
// date and time, no upper or lower bounds, and can be
// incremented by the minute.
JSpinner myTimeSpinner = new JSpinner(
   new SpinnerDateModel(now, null, null, Calendar.MINUTE)
       // This empty method is needed for the MINUTE increment
       // to work; otherwise it increments by the first field
       // in the display
       public void setCalendarField(int field){}
// Define a time format to be used
SimpleDateFormat myTimeFormat =
   new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
// Set the time zone on the format
myTimeFormat.setTimeZone(TimeZone.getTimeZone("Etc/UTC"));
// Set the editor to use the defined time format
myTimeSpinner.setEditor(
   new JSpinner.DateEditor(myTimeSpinner,
   myTimeFormat.toPattern()));Thanks again!
Naomi

When you call myTimeFormat.toPattern(), you are losing the time zone information. You need to instantiate the JSpinner.DateEditor, then call:
editor.getFormat().setTimeZone(TimeZone.getTimeZone("Etc/UTC"))

Similar Messages

  • Change display time zone in iCal?

    Hello-
    I just moved from the east coast to the west coast. I have Time Zone Support turned on in iCal, and I've set my time zone to Pacific Time in the OS X Date & Time Control Panel. Nevertheless, when I create a new event, it defaults to eastern time and I have to change it, and all my appointment times are displaying with their EDT time in iCal. The time is "correct" -- that is, if I create an event at 12:30 pm it displays in iCal as happening at 3:30 pm EDT -- but it's very annoying. See the screenshot for what I'm talking about. Any help would be very helpful!

    See this:
    http://macmost.com/mac-calendar-time-zones.html

  • Changing Date/Time(zone) on ACS5.1

    Would love to know where I can change the date/time(zone) within ACS v5.1.  Changing it in the BIOS doesn't have a zone option, just date/time.  ACS then displays something completely different upon boot.  Haven't been able to find any settings for this in the GUI, and the one link I did find in a discussion points to a doc that apparently I'd need special access for.
    Attempting to join this to AD, so instructions on setting up the NTP server would also be helpful.
    None of these options were available during the clean setup of 5.1.
    Thanks much!

    Hi Wayne,
    This can be done through the command line over a console/SSH connection.
    1. To manually set the clock:
    http://www.cisco.com/en/US/docs/net_mgmt/cisco_secure_access_control_system/5.1/command/reference/cli_app_a.html#wp1036987
    2. To configure an NTP server:
    http://www.cisco.com/en/US/docs/net_mgmt/cisco_secure_access_control_system/5.1/command/reference/cli_app_a.html#wp1013780
    3. To configure the time zone:
    http://www.cisco.com/en/US/docs/net_mgmt/cisco_secure_access_control_system/5.1/command/reference/cli_app_a.html#wp1013028
    Hope this helps,
    Fede
    If  this helps you and/or answers your question please mark the question as  "answered" and/or rate it, so other users can easily find it.

  • How do I stop iCal from ever changing the time zones of my appointments?

    I cannot figure out time zone support in iCal, and just want it never to move the time of an appointment when I change time zones. I have tried switching time zone support on and off, and it makes no difference, the appointment times change when the time zone changes. It's infuriating! How do I make it stop?
    Thanks!

    Whitecity,
    According to iCal Help...Changing the time zone for an event: Choose iCal > Preferences, click Advanced, and select the "Turn on time zone support" checkbox...To change the event's time zone, choose a time zone from the pop-up menu in the Info drawer. To make the event appear at the same time no matter what time zone the main calendar view is in, choose Floating..;~)

  • How change 'home' time-zone in ical?

    Hi
    Question ... how to change 'home' time-zone in ical?
    I have just relocated countries ... to a different time zone.
    I use time-zone support in iCal and add time-zone to various tasks.
    But when i add a task and note it as my now current time-zone then ical immediately alters the diary placement to assume that i am in my old country/time-zone.
    I have altered the region in Preferences/International but this seems to have no effect, in ical at least.
    guidance welcomed
    ross

    In the very upper, right-hand corner of the iCal window is a time zone display, here you can choose to change your iCal time zone.
    If you choose "other" from the time zone display's pop-up menu, you get a dialog just like the Date and Time System Preferences.
    Why this option is not in the iCal preferences, I have no idea. To me, that would make a lot more sense!
    -Doug

  • Changing server time zone

    Hi
    We are planning to change server timezone,now itz running US-Time zone,and we are going to change it to IST( indian time zone ).
    is there any effect on database,.
    As ....instance is in archive log mode, after changing time zone need to take cold backup and archivelogs generated after that only can be used for recovery,...any other.....things we need to take kare of......
    any suggestion will be helpful.
    Regards

    Hi
    You can use Transaction STZAC to change the time zones in ABAP ..
    Thanks
    Prince Jose
    PS: Points appreciated

  • How can I change the time zone while not changing the time

    Let me preface this by saying I know this may seem tiddling to many but it is somthing I am rather obsessive about.
    I took many photos while I was in Los Angeles.  I had changed my camera's clock and the clock in the MacBook Pro to Pacific Standard Time and my iPhone automatically did the same thing. When I loaded photos into Aperture on my MacBook Pro the time information was all correct, all photos tagged in PST.  I had some photos I took on my last day that I did not load into Aperture until I got home to Denver.  When I loaded these images into Aperture they still have the correct time that they were shot but now show as being taken on Mountain Standard Time.  If I change the time zone in Aperture then the image time is also adjusted to be one hour earlier.
    Is there any way I can change the time zone in Aperture while leaving the actual image time alone?

    Hello Mark,
    Aperture will display the "Date created" with respect to the time zone your system is set to, but the "Date" using the time zone the image was taken in.
    You can adjustthe Time Zone for individual images either on import or afterwards using batch change:
    Select the images you want to adjust, then select "Metadata -> Batch Change" from the Aperture Application menu:
    Click: Adjust Time Zone
    Set the Camera's Time Zone to the Time zone you set your camera to when you took the images, and the Actual Time Zone to the zone you want Aperture to use to display the date.
    Regards
    Léonie
    P.S:
    This works with most cameras, but there seems to be a bug with canon cameras when importing directly from the camera. Frank Caggiano recently started a thread, but right now I cannot find the link.

  • How to change the Time Zone of a selected user programically ?

    Hi all,
    I have a specific requirement to develope using Webdynpro. I want to programically change the Time ZOne of a selected  user. Could some one help me . I promise to award points for the solution.
    Thank you in advance
    Regards
    Maruti

    Hi,
    Kindly have a look at the following threads,
    Re: Timezone of current User
    Re: Changing the Time Zone attribute
    Regards,
    Saravanan K

  • Problem caused with appt times by changing calendar time zone support?

    I've got a 30Gb iPod Touch, version 4.0.2.
    I've always kept the Settings' Date & Time timezone for the correct location, but it was only a while back that I realized that there was also a Time Zone under the Settings, Calendar, and so I changed it so that it was correct (it was previously set to Kabul, AF time, and it was then changed to Ottawa, ON time).
    I'm thinking that this may have messed up all my future appointments, as my appointments have been switched to midnight or somewhere near it, for the day prior to when the appointment was supposed to have been. I can't think of anything else that would be causing this, and didn't see this exact problem occurring for anyone else when I did a search of the discussions.
    Does anyone have any idea as to why this is happening and what I can do to set it right?

    Hi Cindiii,
    Time zone support has often been a point of contention and confusion for many users. Unfortunately, there is no simple fix at the present time. Do you have any idea as to why you touch was set to Kabul? Did you buy it new? If not, perhaps the last user had it set to this time?
    In any case, Calendar does allow for its own time zone settings. This is to allow the user to create events for his/her home time zone while traveling. Even if your system time zone reflects the current time zone that you are in, appointments added to Cakendar will show up in the time zine that you choose based in the time zone you set in the Calendar settings.
    This definitely sets up conflicts if you are trying to schedule an appointment that is outside of your home time zone. Now that you have switched the time zone in your Calendar settings to your home time zone, there is nothing you can do about the events already created. As I see it, you have only two options:
    1. Change the time zone back to Kabul time and view your events as though they were your local time, or
    2. Leave the time zone in the Calendar settings to your home time zone and either time adjust the events in your head (knowing the time difference), or manually changing them to the correct time one by one.
    I'm sorry this doesn't provide you with a magic solution, but I really don't see any other alternatives.
    Mac

  • When I change the time zone of the clock, the "Date created" time information for my documents and image files in the Finder window (and in Get Info) is changed. Can I make the time info in "Date created" remain fixed regardless of the clock's timezone?

    When I change the time zone of the clock, the "Date created" time information for my documents and image files in the Finder window (and in Get Info) is changed. Can I make the time info in "Date created" remain fixed regardless of the clock's timezone?

    When I change the time zone of the clock, the "Date created" time information for my documents and image files in the Finder window (and in Get Info) is changed. Can I make the time info in "Date created" remain fixed regardless of the clock's timezone?

  • How can I change the time zone for a calendar entry with iOS 7?

    I want to make a new entry in my calendar (iOS 7) using a different time zone as the one I'm located in. There isn't any option to choose the time zone like there is in OS X.
    I know I can switch off the option to automatically change the time zone in the preference pane of Mail, Contacts and Calendar to get the option in calendar but I want to use this automatic switch.
    Is there any option to change the time zone of a calendar entry without loosing this automatic switch?

    Got it!
    In your backing file you'll need the following in your handlePostbackData method:
    BookBackingContext bookCtx = BookBackingContext.getBookBackingContext(arg0);
    bookCtx.setupPageChangeEvent("PageLabel");

  • Change the time zone in Java System only

    Hi there,
    Does anyone knows where to change the time zone in Java system only? I know in ABAP they have t-code: STZAC? where do I change in Java? Configtool or visual admin? what is the service name or parameter for this?
    Thanks
    Kumar

    hi Kumar,
    You can change the timezone of the JVMs using the -Duser.timezone
    parameter,  add -Duser.timezone=<timezone> to all dispatcher and
    server processes in your systems, using the configtool           
    1) open config tool                                              
    2) select yes                                                    
    3) select "cluster-data->instanceXXX->serverXXX/Dispatcher"      
    4) in "Java parameters" add new line "-Duser.timezone=<timezone>"
    5) click "Apply changes"                                         
    6) restart your instance
    Let me know how is the result
    Regards

  • I have a string 2012-05-22T23:23:42.263-07:00. so i want to convert in date with indian time zone   can any one help me out

    i have a string 2012-05-22T23:23:42.263-07:00. so i want to convert in date with indian time zone   can any one help me out

    What does this have to do with iPhone tech support?

  • My whole document comes out as low res when I export to PDF, even the indesign file also now low res. Tried changing display performance, but that's not helping.

    My whole document comes out as low res when I export to PDF, even the indesign file also now low res. Tried changing display performance, but that's not helping.

    Are your  links up to date? What settings did you use?

  • Error when changing database time zone

    Hi all,
    I have Oracle 9.2.0.1.0 on Windows 2000 Pro. I try to change the time zone of the database using
    ALTER DATABASE SET TIME_ZONE = '+01:00'
    but it fails with error ORA-02231.
    Am I missing something?

    This is an expected behaviour, it's just that the message text was not meaningful.
    Basically if there is a TSLTZ column in the database, user is not allowed to change the database time zone. This is because it will invalid their existing TSLTZ data.
    You should either perform ALTER DATABASE SET TIME ZONE before creating any tables with TSLTZ columns, or drop the TSLTZ columns first before doing the ALTER DB statement.
    According to Bug 2435266, the error message has now been changed to
    ORA-30079: cannot alter database timezone when database has TIMESTAMP WITH LOCAL TIME ZONE columns

Maybe you are looking for

  • Unable to execute SDT request JAVA_EE during the JAVA---Input_adm_user_pwd

    Dear Friends I am stuck in CONFIGURATION PHASE of EHP5 Upgrade. The ABAP phase has been completed but stuck in the Java processing  INPUT_ADM_USER_PWD "unable to execute the SDT request Java_EE operation configure on hostname dbserver1 instance 02 Mo

  • How to view my photos in iCloud?

    I upload some photos to iCloud and sent a mail to some friends. How can I myself look up the photos in iCloud?

  • How to duplicate a sequence in Premiere Pro CS3 within the same project file ?

    Hi there, How do I duplicate a sequence in Premiere Pro CS3 within the same project file ? Thanks

  • Message Mapping Problem

    HI I am calling a Java Mapping Prog from My message Mapping . I get A strange Message when i pass special characters like '?' or '*' through my message mapping to the java mapping . The Message is <b>"For input string : ???". </b> when i pass ??? as

  • Stock transfer PR-URGENT

    Hi I have a scenario urgently to be configured for stock transfer from other plant Plant1(Receiving plant): Proc key- F Spl proc key-40 (from plant 2) Strategy: MTO Plant2(Mfg plant) Proc key- 'E' Strategy : MTO My requirement: When i create a SO in