Friday, December 30, 2016

Saturday, December 10, 2016

Date Time in Java 8

package com.ldap;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

public class DateTimeTest {
private static final String DATE_FORMAT = "dd-M-yyyy hh:mm:ss a";
public static void main(String[] args) {
datetime();
}

private static void datetime() {
String dateInString = "22-1-2015 10:15:55 AM";
        LocalDateTime ldt = LocalDateTime.parse(dateInString, DateTimeFormatter.ofPattern(DATE_FORMAT));

        ZoneId singaporeZoneId = ZoneId.of("Asia/Singapore");
        System.out.println("TimeZone : " + singaporeZoneId);

        //LocalDateTime + ZoneId = ZonedDateTime
        ZonedDateTime asiaZonedDateTime = ldt.atZone(singaporeZoneId);
        System.out.println("Date (Singapore) : " + asiaZonedDateTime);

        ZoneId newYokZoneId = ZoneId.of("America/New_York");
        System.out.println("TimeZone : " + newYokZoneId);
        
        
    LocalDateTime localdate = LocalDateTime.now(newYokZoneId);
    LocalDateTime localdate2 = LocalDateTime.now();
    DateTimeFormatter fmt = DateTimeFormatter.ISO_DATE_TIME;
System.out.println("---> "+localdate.format(fmt));
System.out.println("---> "+localdate2.format(fmt));
        ZonedDateTime nyDateTime = asiaZonedDateTime.withZoneSameInstant(newYokZoneId);
        System.out.println("Date (New York) : " + nyDateTime);

        DateTimeFormatter format = DateTimeFormatter.ofPattern(DATE_FORMAT);
        System.out.println("\n---DateTimeFormatter---");
        System.out.println("Date (Singapore) : " + format.format(asiaZonedDateTime));
        System.out.println("Date (New York) : " + format.format(nyDateTime));
}

}

Tuesday, December 6, 2016

TO READ UP

7th Dec 2016
http://nixmash.com/java/know-your-spring-boot-embedded-servlet-container/
http://www.adam-bien.com/roller/abien/entry/java_8_completablefuture_example
https://spring.io/blog/2016/10/31/webinar-replay-consumer-driven-contracts-and-your-microservice-architecture
https://spring.io/blog/2016/10/27/spring-tips-circuit-breakers
https://www.sitepoint.com/javaone-2016-nucleus/
https://blogs.oracle.com/java/collections-refueled
https://www.infoq.com/articles/Testing-RxJava
http://www.nurkiewicz.com/2016/10/small-scale-stream-processing-kata-part_13.html
http://www.java-allandsundry.com/2016/09/spring-reactive-samples-mono-and-single.html
https://intelligentjava.wordpress.com/2016/10/22/memory-efficient-hashset-implementation-for-java/
http://www.adam-bien.com/roller/abien/entry/high_performance_java_ee_from
https://www.symphonious.net/2016/10/25/testinglmax-screenshots-with-selenium/
http://blog.takipi.com/google-guava-5-things-you-never-knew-it-can-do/
https://blog.codecentric.de/en/2016/09/scrum-unfinished-user-stories/
https://www.infoq.com/presentations/java9-reactive-programming
https://www.infoq.com/articles/rxjava-by-example
https://knes1.github.io/blog/2015/2015-10-19-streaming-mysql-results-using-java8-streams-and-spring-data.html
https://www.infoq.com/articles/Wiremock-testing-mocking-over-wire-stubs
http://www.java-allandsundry.com/2016/11/parallelizing-hystrix-calls.html
http://www.nurkiewicz.com/2016/10/reactive-programming-with-rxjava-book.html
https://vanwilgenburg.wordpress.com/2016/09/19/getting-started-with-akka-stream-kafka/
https://www.infoq.com/news/2016/09/JavaOne-2016-parallel-streams
http://www.adam-bien.com/roller/abien/entry/building_a_react_application_with