Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7583381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:39:50+00:00 2026-05-30T18:39:50+00:00

I have a problem with the standard JSpinner.DateEditor (as probably does everyone else). When

  • 0

I have a problem with the standard JSpinner.DateEditor (as probably does everyone else). When it works with the Java.util.Date class, it only gets a default format from the Locale set on the spinner. It appears to be TimeZone ignorant.

When we have a Date that is on the March Clock change day which in the UK has no 2 o’clock – the time jumps from 01:59:59.999 AM to 03:00 AM with day light savings applied.

Therefore in the JSpinner.DateEditor I do not want the user to see anything for 02:00 to 02:59:59.999. When the hour is on 1 and they click up, I want to jump to 3 and vice versa.

Is it possible to implement any kind of workaround to do this?

Many thanks

Andez

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:39:51+00:00Added an answer on May 30, 2026 at 6:39 pm

    can you please edit your question and use this SSCCE that demonstrating your issue about DTS

    import java.awt.*;
    import java.text.SimpleDateFormat;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    
    public class TimeZoneSpinners {
    
        private final String[] zones = {"Asia/Tokyo", "Asia/Hong_Kong",
            "Asia/Calcutta", "Europe/Paris", "Europe/London",
            "America/New_York", "America/Los_Angeles"
        };
        private final JLabel[] labels = new JLabel[zones.length];
        private final SimpleDateFormat[] formats = new SimpleDateFormat[zones.length];
        private JSpinner spinner;
        private SpinnerDateModel model;
        private SimpleDateFormat format;
        private JPanel panel;
        private JFrame frame = new JFrame();
    
        public void makeUI() {
            Calendar cal = Calendar.getInstance();
            Date date = cal.getTime();
            model = new SpinnerDateModel();
            model.setValue(date);
            spinner = new JSpinner(model);
            spinner.addChangeListener(new ChangeListener() {
    
                @Override
                public void stateChanged(ChangeEvent e) {
                    Date date = (Date) ((JSpinner) e.getSource()).getValue();
                    for (int i = 0; i < labels.length; i++) {
                        labels[i].setText(formats[i].format(date));
                    }
                }
            });
            format = ((JSpinner.DateEditor) spinner.getEditor()).getFormat();
            format.setTimeZone(TimeZone.getTimeZone(zones[0]));
            format.applyPattern("yyyy-MM-dd HH:mm:ss");
            panel = new JPanel(new GridLayout(zones.length, 2, 10, 10));
            for (int i = 0; i < zones.length; i++) {
                formats[i] = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss");
                formats[i].setTimeZone(TimeZone.getTimeZone(zones[i]));
                JLabel label = new JLabel(zones[i]);
                labels[i] = new JLabel(formats[i].format(date));
                panel.add(label);
                panel.add(labels[i]);
            }
            frame.setLayout(new BorderLayout(10, 10));
            frame.add(spinner, BorderLayout.NORTH);
            frame.add(panel, BorderLayout.CENTER);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setVisible(true);
        }
    
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
    
                @Override
                public void run() {
                    new TimeZoneSpinners().makeUI();
                }
            });
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with caling the getResources() function in an standard class. All
I have the following problem that the standard library doesn't solve well, and I'm
I have a reacurring problem. I code nice standards compliant code only to have
I have a problem with Spring 3.0.7 Request mapping and the Spring standard theme
I have a problem with bounded nested wildcards in Java generics. Here's a common
I have a serious problem with calculating Standard Deviation within subgroup in SSRS/SQl (whichever
I have a problem with the init() method of a standard NSObject. I wrote
I have a problem which is an extension of 2-SAT problem. In standard 2-SAT
I have a problem with image scaling in .NET. I use the standard Graphics
I have Java webserver (no standard software ... self written) . Everything seems to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.