Welcome to my channel. Please Subscribe, like and share.
It is greatly appreciated.
#legendaryprogrammer
CODE:
//'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()));
}
}
END CODE
Are you struggling with coding such as C++, android or java. Look no further. I got you. Compilers are annoying and can drive us mad, wasting hours trying to find the answer that could be a as simple as a comma. That's why I'm here. To save you time and headache. Subscribe to my channel so you can rest easy. Spread the word far and wide that programmers united does not have to worry!
If you have any requests or suggestions, let me know in the comments. Thanks :)