public class DateFormat {
public static void main(String[] args) {
int year;
int day;
int month;
String format = "";
System.out.println("Enter a year: " );
Scanner scanner = new Scanner(System.in);
year = scanner.nextInt();
Scanner scanner2 = new Scanner(System.in);
System.out.println("Enter a Month: " );
Scanner scanner1 = new Scanner(System.in);
month = scanner2.nextInt();
System.out.println("Enter a Day: ");
day = scanner1.nextInt();
System.out.println("Chose Format: (b/l/m) ");
Scanner scanner3 = new Scanner(System.in);
format = scanner3.nextLine();
}
}
I managed to ask ueser for the, day month and year, asks user which formate is prefered and but how can i get the program to display the results in the chosen order?
How to make formulate the code for each option?
And finally how do I make sure any single entred digit like 7 is changed to 07?
These formates are called big-endian, little-endian and middle-endian, yyyy/mm/dd dd/mm/yyyy and even mm/dd/yyyy. I am trying to make the format to be returned as a string from a method that takes the year, month, day and format as input.