I'm curious how Java SimpleDateFormat decides when to increase / decrease the time elapsed based on the set time zone.
Let's say I have a date 04/04/2013. Then I set the time zone to one far from me (I am in GMT-5). Let's say I use GMT + 8.
I'm calling
SimpleDateFormat df = new SimpleDateFormat( "M/d/yy" ); df.setTimeZone( TimeZone.getTimeZone( "GMT+8" ) ); df.parse( endDate ) // this returns 06/**03**/2013 //endDate is just a String
He returns 03/03/2013. Why does it reduce it?
Edit: Basically, I ask what is the benchmark that Java uses to cancel my date to 6/3 if I set it to GMT + 8. There is some kind of logic that says I'm not in this current hour belt, so let it change that. But since I am passing the string, I do not see where it could be.
I assume by default, if I do not provide the time zone in the string, by default it will be GMT.
source share