I am using the following code to get current time in UNIX
System.currentTimeMillis() / 1000L
But it is returning the current GMT but I need the device time in UNIX. for Example, if the time zone is GMT + 5 it should return GMT + 5 but currently it's not.
I even tried this
Date utcDate=new Date();
utcDate.setTime(System.currentTimeMillis());
long currentTime = utcDate.getTime();
but no luck.
All other answers on SO is returning current GMT only. I can't hard code the Time Zone as it could be anywhere around the world.
Update:
I don't need my device's timezone I need UNIX time in my TimeZone. The Mark Duplicate question is only providing the time zone and Time in Date or Calendar Formate
Thanks