'Print date from input ID user in java

I have to make a code that take an user name input and then an ID number that is based format as ( 1102199344556699 - where the first 8 characters is his day of birth). My code:

import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;
import java.util.Locale;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {

        //user input
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter your name: ");
        int length = scanner.nextLine()
                .length();
        System.out.println(length);

        //user id input
        Scanner scanner2 = new Scanner(System.in);
        System.out.println("Enter your id number");
        String idNUmber = scanner2.nextLine();
        if (idNUmber.length() < 11) {
            throw new InvlaidIdException("invalid");
        } else {
        String dateOfBirth = idNUmber.substring(0, 8);

    //found this way,on the output is giving me from input -110219935656525
   //output is ok but as you can see on My output i get some extra things (please see OUTPUT)
        TemporalAccessor date = DateTimeFormatter.ofPattern("ddMMyyyy").withLocale(Locale.FRANCE).parse(dateOfBirth);
            System.out.println(date);
                }
            }
        }

INPUT user Id -110219935656525

OUTPUT:

This is  the birthday date: {},ISO resolved to 1993-02-11

How can i get rid of {},ISO resolved to ? Thanks,



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source