The requirement is to simply to get the current wall time (including the correct DST adjustment) for a given Time Zone.
There seems to be a few questi
I find the following to be the cleanest method.
DateTime currentTime = DateTime.now( DateTimeZone.UTC );
This gets you the current time in UTC but this value can be converted to another DateTimeZone
or you can replace DateTimeZone.UTC
with a different DateTimeZone
.
If you want to set it to the system timezone, you can use this:
DateTime currentTime = DateTime.now( DateTimeZone.getDefault() );