Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Date and Time
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.Date; import java.text.SimpleDateFormat; import java.util.TimeZone; class Rextester { public static void main(String[] args) { //"hh" in pattern is for 12 hour time format and "aa" is for AM/PM SimpleDateFormat dateTimeInGMT = new SimpleDateFormat("yyyy-MMM-dd hh:mm:ss aa"); //Setting the time zone dateTimeInGMT.setTimeZone(TimeZone.getTimeZone("GMT")); System.out.println(dateTimeInGMT.format(new Date())); } }
run
|
edit
|
history
|
help
0
polymorphic mapper
assignment 3
jsis
bubble sort
h
Alphabets
Question FizzBuzz
f
javajava
4.a