fork download
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

import java.time.*;
import java.time.temporal.*;
import java.time.format.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{

    ZoneId zP_K = ZoneId.of( "Pacific/Kiritimati" ) ;
    ZoneId zP_G = ZoneId.of( "Pacific/Gambier" ) ;

    Instant instant = Instant.now() ;  // Current moment in UTC, with resolution up to nanoseconds.

    ZonedDateTime zdtP_K = instant.atZone( zP_K ) ;
    ZonedDateTime zdtP_G = instant.atZone( zP_G ) ;

    Boolean sameMoment = zdtP_K.isEqual( zdtP_G ) ;  
    
    System.out.println( "instant.toString(): " + instant ) ;
    System.out.println( "zdtP_K.toString(): " + zdtP_K ) ;
    System.out.println( "zdtP_G.toString(): " + zdtP_G ) ;
    System.out.println( "sameMoment: " + sameMoment ) ;
    
	}
}
Success #stdin #stdout 0.15s 4386816KB
stdin
Standard input is empty
stdout
instant.toString(): 2017-06-15T12:53:35.276Z
zdtP_K.toString(): 2017-06-16T02:53:35.276+14:00[Pacific/Kiritimati]
zdtP_G.toString(): 2017-06-15T03:53:35.276-09:00[Pacific/Gambier]
sameMoment: true