Java tutorial
import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; public class Main { public static void main(String[] argv) { String dayAfterTommorrow = "20140116"; LocalDate formatted = LocalDate.parse(dayAfterTommorrow, DateTimeFormatter.BASIC_ISO_DATE); System.out.printf("Date generated from String %s is %s %n", dayAfterTommorrow, formatted); System.out.println("Formatted today = " + DateTimeFormatter.BASIC_ISO_DATE.format(LocalDateTime.now())); } }