{"action":"created","issue":{"url":"https://api.github.com/repos/JodaOrg/joda-time/issues/266","labels_url":"https://api.github.com/repos/JodaOrg/joda-time/issues/266/labels{/name}","comments_url":"https://api.github.com/repos/JodaOrg/joda-time/issues/266/comments","events_url":"https://api.github.com/repos/JodaOrg/joda-time/issues/266/events","html_url":"https://github.com/JodaOrg/joda-time/issues/266","id":68389690,"number":266,"title":"Bug in addSeconds()?","user":{"login":"bojlxb","id":11944591,"avatar_url":"https://avatars.githubusercontent.com/u/11944591?v=3","gravatar_id":"","url":"https://api.github.com/users/bojlxb","html_url":"https://github.com/bojlxb","followers_url":"https://api.github.com/users/bojlxb/followers","following_url":"https://api.github.com/users/bojlxb/following{/other_user}","gists_url":"https://api.github.com/users/bojlxb/gists{/gist_id}","starred_url":"https://api.github.com/users/bojlxb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bojlxb/subscriptions","organizations_url":"https://api.github.com/users/bojlxb/orgs","repos_url":"https://api.github.com/users/bojlxb/repos","events_url":"https://api.github.com/users/bojlxb/events{/privacy}","received_events_url":"https://api.github.com/users/bojlxb/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JodaOrg/joda-time/labels/Discussion","name":"Discussion","color":"fbca04"},{"url":"https://api.github.com/repos/JodaOrg/joda-time/labels/NotABug","name":"NotABug","color":"5319e7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-14T14:18:23Z","updated_at":"2015-04-25T14:17:14Z","closed_at":"2015-04-25T14:17:14Z","body":"**Code:**\r\n```\r\nimport java.text.SimpleDateFormat;\r\nimport java.util.Calendar;\r\n\r\nimport org.joda.time.DateTime.Property;\r\nimport org.joda.time.DateTimeZone;\r\nimport org.joda.time.MutableDateTime;\r\n\r\n\r\npublic class joda_datetime2 {\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\tlong time = 1174788000000L;\r\n\t\tint interval = -49680;\r\n\t\tSimpleDateFormat sdt = new SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ss.SSSXXX\");\r\n\t\t\r\n\t\t/* CALENDAR */\r\n\t\tCalendar c = Calendar.getInstance();\r\n\t\tc.setTimeInMillis(time);\r\n\t\tSystem.out.println(\"CALENDAR1: \" + sdt.format(c.getTime()) + \" - \" + c.getTimeZone());\r\n\t\tc.set(Calendar.SECOND, c.get(Calendar.SECOND)+interval);\r\n\t\tSystem.out.println(\"CALENDAR2: \" + sdt.format(c.getTime()) + \" - \" + c.getTimeZone());\r\n\t\t\r\n\t\t/* JODA */\r\n\t\tMutableDateTime mdt = new MutableDateTime(time);\r\n\t\tSystem.out.println(\"____JODA1: \" + sdt.format(mdt.toDate()) + \" - \" + mdt.getZone().toTimeZone());\r\n\t\tmdt.addSeconds(interval);\r\n\t\tSystem.out.println(\"____JODA2: \" + sdt.format(mdt.toDate()) + \" - \" + mdt.getZone().toTimeZone());\r\n\t}\r\n\r\n}\r\n```\r\n\r\n**Results:**\r\n\r\n> CALENDAR1: 2007-03-25T09:00:00.000+07:00 - sun.util.calendar.ZoneInfo[id=\"Asia/Novosibirsk\",offset=21600000,dstSavings=0,useDaylight=false,transitions=68,lastRule=null]\r\n> CALENDAR2: 2007-03-24T**19**:12:00.000+06:00 - sun.util.calendar.ZoneInfo[id=\"Asia/Novosibirsk\",offset=21600000,dstSavings=0,useDaylight=false,transitions=68,lastRule=null]\r\n> ____JODA1: 2007-03-25T09:00:00.000+07:00 - sun.util.calendar.ZoneInfo[id=\"Asia/Novosibirsk\",offset=21600000,dstSavings=0,useDaylight=false,transitions=68,lastRule=null]\r\n> ____JODA2: 2007-03-24T**18**:12:00.000+06:00 - sun.util.calendar.ZoneInfo[id=\"Asia/Novosibirsk\",offset=21600000,dstSavings=0,useDaylight=false,transitions=68,lastRule=null]\r\n"},"comment":{"url":"https://api.github.com/repos/JodaOrg/joda-time/issues/comments/96211540","html_url":"https://github.com/JodaOrg/joda-time/issues/266#issuecomment-96211540","issue_url":"https://api.github.com/repos/JodaOrg/joda-time/issues/266","id":96211540,"user":{"login":"jodastephen","id":213212,"avatar_url":"https://avatars.githubusercontent.com/u/213212?v=3","gravatar_id":"","url":"https://api.github.com/users/jodastephen","html_url":"https://github.com/jodastephen","followers_url":"https://api.github.com/users/jodastephen/followers","following_url":"https://api.github.com/users/jodastephen/following{/other_user}","gists_url":"https://api.github.com/users/jodastephen/gists{/gist_id}","starred_url":"https://api.github.com/users/jodastephen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jodastephen/subscriptions","organizations_url":"https://api.github.com/users/jodastephen/orgs","repos_url":"https://api.github.com/users/jodastephen/repos","events_url":"https://api.github.com/users/jodastephen/events{/privacy}","received_events_url":"https://api.github.com/users/jodastephen/received_events","type":"User","site_admin":false},"created_at":"2015-04-25T14:17:14Z","updated_at":"2015-04-25T14:17:14Z","body":"Comparing JDK calendar and Joda-Time is difficult. In this case, simply print out the difference in the millisecond timestamp before and after:\r\n\r\n        long startInstant1 = time / 1000L;\r\n        long endInstant1 = c.getTimeInMillis() / 1000L;\r\n        System.out.println(endInstant1 - startInstant1);\r\n\r\nand you will get `-46080`, which is 3600 seconds less than the subtraction requested.\r\n\r\nJoda-Time has subtracted -49680 seconds as requested. The JDK subtracted -49680 seconds from the *local* time-line and then adjusted the millisecond instant to match, which results in an hour difference thanks to DST.\r\n"}}