I have following code, running on Unix server (WAS 5.1), it’s a test environment in our company. When I try to execute the below code, I always get yesterday’s date (i.e if I execute today 9/27/2012 it returns date as 9/26/2012)
long userSelectedTimeLong = date.getTime()
Date returns time based on
TimeZoneof the machine. It is possible that your sever might be hosted some where else and TimeZone value is different.You need to compare value of date by having same TimeZone.
Once you do that next task is is
datevariable really contains current date. You can print a simple log usingnew Date().getTime()