Hello,
For my Java class I have to output the date in multiple formats. So I was going to start very simple and came up with the following code
[code]
import java.util.Date;
import java.text.*;
public class TestDate {
public static void main(String[] args) {
Date date1 = new Date();
SimpleDateFormat for1 = new SimpleDateFormat("yyyy/MM/dd");
SimpleDateFormat for2 = new SimpleDateFormat("MM/dd/yy");
System.out.println("yyyy/MM/dd");
System.out.println(for1.format(date1));
System.out.println("MM/dd/yy");
System.out.println(for2.format(date1));
}
}
[\code]
I am using Eclipse and the output is
MM/dd/yy
10/15/18
I was expecting
yyyy/MM/dd
2018/10/15
MM/dd/yy
10/15/18
I don't have any errors and I notice that when I click the run button, the output console flashes. It's very fast, but it looks like it initially flashes my intended output.
Any ideas as to what is happening?