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

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

import java.time.* ;
import java.time.format.* ;
import java.time.temporal.* ;
import java.time.chrono.* ;
import java.time.zone.* ;
import java.sql.Timestamp ;


/* 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
	{

	    LocalDate ld = LocalDate.of( 2020 , Month.JANUARY , 23 );
	    LocalTime lt = LocalTime.of( 23 , 0 );
	    ZoneId zMontreal = ZoneId.of( "America/Montreal" );
	    ZonedDateTime zdt = ZonedDateTime.of( ld , lt , zMontreal );
	    Instant instant = zdt.toInstant();
	    // Convert from modern class to troubled legacy class `Timestamp`.
	    java.sql.Timestamp ts = Timestamp.from( instant );
	    
	    // Dump to console
	    System.out.println( "zdt.toString() = " + zdt );
        System.out.println( "instant.toString() = " + instant );
        System.out.println( "ts.toString() = " + ts );
        System.out.println( "JVM’s current default time zone: " + ZoneId.systemDefault() );
	
	    // Imagine at runtime the JVM’s current default time zone is `Asia/Tokyo`.
	    TimeZone.setDefault( TimeZone.getTimeZone( "Asia/Tokyo" ) );
	    LocalDate localDate = ts.toLocalDateTime().toLocalDate();
	
	    // Compare results.
	    boolean sameDate = ld.isEqual( localDate );
	    System.out.println( "sameDate = " + sameDate + " | ld: " + ld + " localDate: " + localDate );
    
	}
}