tl;dr
ZonedDateTime.of( 2016 , 9 , 10 , 10 , 0 , 0 , 0 , ZoneId.of( "Europe/Paris" ) )
Details
The accepted answer by Ɍ.Ɉ is correct.
java.time
Here is the way to do the same but with modern java.time classes that supplant the troublesome old legacy date-time classes.
The http://docs.oracle.com/javase/8/docs/api/java/time/ZonedDateTime.html class represents a moment on the timeline in a particular time zone with a resolution of nanoseconds. Instantiate with all the specific year, month, hour, etc. arguments: of(int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond, ZoneId zone)
.
ZoneId z = ZoneId.of( "Europe/Paris" );
ZonedDateTime zdt = ZonedDateTime.of( 2016 , 9 , 10 , 10 , 0 , 0 , 0 , z );
See a String representation of that value in standard ISO 8601 format extended by appending name of time zone in square brackets.
String output = zdt.toString();
2016-09-10T10:00:00+02:00[Europe/Paris]
If you want Strings generated in other formats, search Stack Overflow for DateTimeFormatter
.
About java.time
The java.time framework is built into Java 8 and later. These classes supplant the old troublesome date-time classes such as java.util.Date
, .Calendar
, & java.text.SimpleDateFormat
.
The Joda-Time project, now in maintenance mode, advises migration to java.time.
To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations.
Much of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport and further adapted to Android in ThreeTenABP (see How to use…).
The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time. You may find some useful classes here such as Interval
, YearWeek
, YearQuarter
, and more.