1.client computer - on this machine timzone is set to AZST
2.server computer - on this machine timezone is set to GMT+4
location are set to United States , both machines
so my swing application calls ejb2 method from client machine to server and passes date which is 31/08/2011(Wed Aug 31 00:00:00 AZST 2011)
but server logs it as 30/08/2011(Tue Aug 30 23:00:00 GMT+04:00 2011), i pass it by Date object , so my question is would it be better/helpful if i try to pass with long value and construct date on server side? or how is teqnique at this situation?
The Date essentially IS the long value, it just has some (mostly deprecated) methods which allow you to treat that long value as a Date. So passing a long value doesn't fix the problem.
What we did when we had that problem was to pass a Date and a Timezone; the Timezone we passed was the default time zone for the client. On the server side we formatted the date using the timezone passed from the client, not using the server's default time zone.