Java timezone - strange behavior with IST?

java timezone list
java.util.timezone java 8
java timezone offset list
java gmt timezone
java convert date from one timezone to another
groovy timezone list
android timezone list
timezone australia java

I have the below code:

DateFormat df = new SimpleDateFormat("M/d/yy h:mm a z");
System.out.println(df.parse("6/29/2012 5:15 PM IST"));

Assuming I now set my PC's timezone to Pacific Time (UTC-7 for PDT), this prints

Fri Jun 29 08:15:00 PDT 2012

Isn't PDT 12.5 hours behind IST (Indian Standard Time)? This problem does not occur for any other timezone - I tried UTC, PKT, MMT etc instead of IST in the date string. Are there two ISTs in Java by any chance?

P.S: The date string in the actual code comes from an external source, so I cannot use GMT offset or any other timezone format.

Sorry, I have to write an answer for this, but try this code:

public class Test {

    public static void main(String[] args) throws ParseException {
        DF df = new DF("M/d/yy h:mm a z");
        String [][] zs = df.getDateFormatSymbols().getZoneStrings();
        for( String [] z : zs ) {
            System.out.println( Arrays.toString( z ) );

    private static class DF extends SimpleDateFormat {
        public DateFormatSymbols getDateFormatSymbols() {
            return super.getDateFormatSymbols();

        public DF(String pattern) {


You'll find that IST appears several times in the list and the first one is indeed Israel Standard Time.

java - SimpleDateFormat is not giving right time?, Help me understand the behavior. getTimeZone("IST")); //Local time zone SimpleDateFormat dateFormatLocal = new SimpleDateFormat("yyyy-MMM-dd  Timezone weirdness in java 1.5 806557 May 7, 2005 8:40 PM I'm seeing some strange behavior when dealing with timezones in a webstart app.

The abberviated names of timezone are ambiguous and have been deprecated for Olson names for timezones. The following works consistently as there may be be differences in the way parse() and getTimezone() behaves.

SimpleDateFormat sdf = new SimpleDateFormat("M/d/yy h:mm a Z");
TimeZone istTimeZone = TimeZone.getTimeZone("Asia/Kolkata");
Date d = new Date();
String strtime = sdf.format(d);

Men's Health, PAGE134 WEALTH 1) Try a beer run Commit yourself and your. 116 JANUARY FEBRUARY 2008 132 JANUARY/FEBRUARY 2008 Disagree with this list? Java API - strange behavior on first time index creation. Elasticsearch. Slava_G (Slava G ) 2011-05-30 22:12:14 UTC #1. Hi, Tried to create index on clean

Not an answer but see the output + code below - it does seem that parse treats IST differently from TimeZone.getTimeZone("IST")...

Fri Jun 29 16:15:00 BST 2012 Fri Jun 29 12:45:00 BST 2012 Fri Jun 29 12:45:00 BST 2012 *BST = London

public static void main(String[] args) throws InterruptedException, ParseException {
    DateFormat fmt1 = new SimpleDateFormat("M/d/yy h:mm a Z");
    Date date = fmt1.parse("6/29/2012 5:15 PM IST");

    DateFormat fmt2 = new SimpleDateFormat("M/d/yy h:mm a");
    System.out.println(fmt2.parse("6/29/2012 5:15 PM"));

    DateFormat fmt3 = new SimpleDateFormat("M/d/yy h:mm a");
    System.out.println(fmt3.parse("6/29/2012 5:15 PM"));

Working with Time Zones, A list of current W3C publications and the latest revision of this use half-hour or even quarter-hour offsets (or even some odd offsets). Adoption Dates Regions that currently have the same UTC offset and DST behavior may have had As mentioned above, many incremental time values (such as Java's  Hi, I just upgraded OH to Beta3 and it has some strange behavior. -OH2 running on a Raspberry Pi OS configured with correct local time (For example 16:00) (UTC+2) -My NTP thing is correctly configured (I also tried with different configurations such Europe/Berlin) hostname: Timezone: Europe/Madrid Locale: es_ES -The time I get on my Sitemaps is -2h (14:00) which corresponds to

It is because of IST will have multiple meanings like Irish Standard Time, Isreal Standrad Time, Indian Standard Time.


Use setTimezone() method specifically to set the timezone.

Ex: parser.setTimeZone(TimeZone.getTimeZone("specify timezone in detail here"));

Java's java.util.TimeZone, Java Time Zone is messed up I am running a Tomcat Funny thing is that this ID doesn't appear in a list provided by TimeZone.​getAvailableIDs(). Strange behavior, with timezone maybe? How can the  Giving time zone explicitly frees us from relying on the default time zone of the JVM. If I understand your question correctly, the JVM time zone setting didn’t reflect the time zone setting of your device. It’s possible for the two to be different, but how that came to be in your case, I cannot tell. Possible explanations include:

TimeZone 1 « TimeZone « Java Data Type Q&A, Java Native Interface 3.2.1 Time Zone Display Name Types; 3.2.2 Time Zone Pattern Usage Relative time styles are not currently supported, and behave just like the If you need a more unusual pattern, construct a SimpleDateFormat directly and give it an example: if Monday is 1st day, Tuesday is 2nd ), e or ee eee But when I attempt to insert data from a Java application (using JPA/EclipseLink), the time is rounded to the nearest full second (losing the fractional component). If I disable the trigger, the time is inserted correctly, except in the local time zone. I know that I can work around the issue by performing the translation to GMT in my Java app.

Formatting Dates and Times, NET and Java APIs for file formats – natively work with DOCX, XLSX, PPT, PDF, images and more Web apps typically require that dates are stored in time zone agnostic fashion. which drops down a list retrieved with TimeZoneInfo. Funny timing - I have been globalizing a Vacation tracking system for  Hi there, I encountered a strange scenario last Friday, January the 8th. Here is my code : //Last friday DateTime dateFrom = new DateTime().withYear(2016).withDayOfMonth(8).withMonthOfYear(1); //Get number of week and year int prevWeek =

Back to Basics: UTC and TimeZones in .NET Web Apps, Learn about the time zone specifics of Azure SQL Database NET · Node.js · Java · Go for a new instance, select a time zone from the list of supported time zones. Analyze the application behavior and the results of the queries and Because of certain rare use cases keeping the same time zone  A time zone is a region on Earth that has a uniform standard time for legal, commercial, and social purposes. It is convenient for areas in close commercial or other communication to keep the same time, so time zones tend to follow the boundaries of countries and their subdivisions.

  • There are several ISTs as far as I know. Judging by the time difference (9 hours), you've probably got Israel Standard Time.
  • @biziclop I thought about this. But what veered me away from that was the below: System.out.println(TimeZone.getTimeZone("IST").getRawOffset()); This prints 19800000, or 5.5 hours, which suggests that it is indeed Indian Standard Time. Or is it picking up the first of many timezones with the same ID "IST"? If so, how can something be an "ID" if it is the same for many things?
  • @esej It's more likely to be an ambiguity in the timezone abbreviations:
  • Looking at the source code it seems that IST is India...
  • @Vasan it's not really an ID and SimpleDateFormat is a strange beast, it's very likely that it isn't using TimeZone.getTimeZone() at all.
  • Thank you, that is quite helpful. I suppose then that I'd have to do something weird like stripping the timezone from the date string before parsing it. The timezone part I can then pass to TimeZone.getTimeZone() to get the actual timezone (I suppose even that isn't guaranteed to work always!). It is all getting patchy now, damn you DateFormat!
  • @Vasan Well, DateFormat isn't the only culprit here, the basic problem is that the time zone acronyms aren't unique. In hindsight that was a daft idea. :)
  • Yes, it's exactly what I said. SimpleDateFormat is a strange beast and doesn't play by the rules. It has its own time zone data array and uses whatever comes first in it.