Hi,
I have a simple question, but am confused how to do it:
I need the current GMT date (as a Date object) ..how do I do it?
Date date = new Date();
This returns the current date but according to the timezone of the system time & not GMT.
Using SimpleDateFormat comes close but it returns as a
String object:
SimpleDateFormat dateFormat = new SimpleDateFormat("some format");
dateFormat.setTimeZone(new SimpleTimeZone(0, "GMT"));
Date date = new Date();
String dateAsString = dateFormat.format(date);
This gets the current GMT date but as a String object, but I want it as a Date object.
Can you please throw some light on this? I guess there should be simple way to do it or am overlooking something.
Thanks!