Joda-Time
This kind of work is much easier using the Joda-Time library.
Time Zone
You should specify a time zone, rather than rely on default of the JVM/host computer. Seems that you want UTC (no time zone offset), so your code should say so explicitly.
Half-Open
Also, getting the last moment of a day is tricky. In theory, there is always another divisible fraction of second before the start of the next day. While you want to resolve to seconds (Unix item), two of the common Java libraries (java.util.Date/.Calendar and Joda-Time) use milliseconds, and the new java.time library in Java 8 resolves to nanoseconds. Instead, date-time work is often done using the "half-open" approach where a span of time is defined with the beginning to be inclusive and the ending to be exclusive. So "January" runs from first moment of January 1
to first moment of February 1
.
Example
Here is some example code in Joda-Time 2.3.
DateTimeZone timeZone = DateTimeZone.UTC;
DateTime start = new DateTime( 2011, DateTimeConstants.JANUARY, 1, 0, 0, 0, timeZone).withTimeAtStartOfDay();
DateTime stop = start.plusMonths( 1 );
You might find the Interval class interesting for related work.
Interval january2011 = new Interval( start, stop );
Convert to seconds, from milliseconds.
long secondsStart = start.getMillis()/1000L;
long secondsStop = stop.getMillis()/1000L;