Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Java - SimpleDateFormat(ting)
//Java - SimpleDateFormat(ting) //'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_45 import java.util.*; import java.lang.*; import java.text.SimpleDateFormat; class Rextester { public static void main(String args[]) { System.out.println("START"); Date myDate = new Date(); String[] formats = new String[] { "yyyyMMdd", "yyyy-MM-dd", "yyyy-MM-dd HH:mm", "yyyy-MM-dd HH:mmZ", "yyyy-MM-dd HH:mm:ss.SSSZ", "yyyy-MM-dd'T'HH:mm:ss.SSSZ", }; for (String format : formats) { SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.US); System.out.format("%30s %s\n", format, sdf.format(myDate)); //sdf.setTimeZone(TimeZone.getTimeZone("UTC")); //System.out.format("%30s %s\n", format, sdf.format(myDate)); } //Simple (one-liner) System.out.println("\n" + new SimpleDateFormat("yyyy-MM-dd",Locale.US).format(new Date())); System.out.println("END"); } }
run
|
edit
|
history
|
help
0
fb_series
상속1
Problem: on_off
Sort
names
1
hello_world_test
output2
pourWater
// Java Coding Challenge - 10: Palindrome numbers