Run Code
|
API
|
Code Wall
|
Users
|
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
Please
log in
to post a comment.
MAP List Iterator
Java
strstr() function / indexOf() function
decToBin
calc exp
Pipes
LambdaExpression
MP8 game
binary search
Random and count of even numbers (ver. 2)
Please log in to post a comment.