Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Java - SimpleDateFormat(ting) for XML
//Title of this code //'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 System.out.println("\n" + new SimpleDateFormat("yyyy-MM-dd",Locale.US).format(new Date())); System.out.println("END"); } }
run
|
edit
|
history
|
help
0
inheritance
Even Numbers
tilt
updated
Municipiu_Problema_2_Palindrome
smallest number and its index(position)
arithematic
Array 11 grade (1-99)
homework
4.A