I understand that Date.getTime() in Java will return the millis since EPOCH, considering the Date as a UTC Date.
On Java 6, I have a Date, on which if I execute Date.getTime(), it returns the millis since EPOCH, considering the Date is in PDT timezone. (The server on which I am running the code is configured in the PDT time.)
I want the program to consider it a UTC date and return the milli seconds since EPOCH.
Following is my code snippet and the output:
logger.debug("Date: " + someDate);
logger.debug("someDate in millis): " + someDate.getTime());
Output:
Date: 2016-08-19 12:04:56.993
someDate in millis: 1471633496993 //This is time since EPOCH for 2016-08-19 12:04:56.993 PDT
whereas I want it to return the millis as 1471608296993 (1471608296993 is millis since EPOCH for UTC Date: 2016-08-19 12:04:56.993)
In short I want to get the millis since EPOCH, irrespective of the local timezone, which in my case is PDT.
Please help.