Skip to content

Instantly share code, notes, and snippets.

@dante-byte
Created May 5, 2016 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dante-byte/e3da753a6f19752565daaf8af1f3b19f to your computer and use it in GitHub Desktop.
Save dante-byte/e3da753a6f19752565daaf8af1f3b19f to your computer and use it in GitHub Desktop.
/**
* Created by Donta White on 4/26/2016.
*/
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.Scanner;
public class MyCommandLines {
public static void main(String[] args){
nextLine();
}
public static void nextLine(){
LocalDateTime now = LocalDateTime.now();
LocalTime noa = LocalTime.now();
LocalDate loa = LocalDate.now();
LocalDate date = LocalDate.now();
DateTimeFormatter aFormatter = DateTimeFormatter.ofPattern("EEEE");
DateTimeFormatter bFormatter = DateTimeFormatter.ofPattern("h:m:s a");
DateTimeFormatter cFormatter = DateTimeFormatter.ofPattern("L/d/y");
DateTimeFormatter dFormatter = DateTimeFormatter.ofPattern("L/d/y h:m:s a");
//String today = now.format("dayFormatter");
//DateTimeFormatter dayFormatter = DateTimeFormatter.ofPattern("EE");
/*
TO GET THE DAY OF THE WEEK:
String today = now.format(dayFormatter);
System.out.println(today);
*/
for (int start = 0; start < 1000; start++) {
System.out.println("TYPE A ? TO GET A LIST OF OPTIONS");
Scanner lineScanner = new Scanner(System.in);
String myCommand = lineScanner.nextLine();
if (myCommand.equals("?")) {
System.out.println("time: returns the current time");
System.out.println("date: returns the current date");
System.out.println("datetime: returns the current date and time");
System.out.println("day: returns the day of the week");
System.out.println("exit: ends your program");
}
if (myCommand.equals("time")) {
System.out.println(">" + " " + now.format(bFormatter));
}
if (myCommand.equals("date")) {
System.out.println(">" + " " + now.format(cFormatter));
}
if (myCommand.equals("datetime")) {
System.out.println(">" + " " + now.format(dFormatter));
}
if (myCommand.equals("day")) {
System.out.println(">" + " " + date.format(aFormatter));
}
if (myCommand.equals("exit")) {
System.out.println(">" + " " + "inputtest");
break;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment