Re: how to make dates without timezones?



epicwinter wrote:
On Feb 21, 1:14 pm, Arne Vajhøj <a...@xxxxxxxxxx> wrote:
epicwinter wrote:
On Feb 21, 12:11 pm, Arne Vajhøj <a...@xxxxxxxxxx> wrote:
epicwinter wrote:
On Feb 21, 11:04 am, Mark Space <marksp...@xxxxxxxxxxxxxx> wrote:
epicwinter wrote:
I have tried this too. It works in some respects but creates new
issues. There are a few areas where time is pertinent on my
application and in this manner it would always show the client the
wrong time unless they happened to actually be in the same time zone
as the server.
This implies to me that you have two different types of dates, and you
shouldn't be trying to use the same type (java.util.Date) for both.
Break one or the other out into a separate class so you can deal with
its idiosyncrasies separately. I would also not use a subclass of
java.util.Date.
String probably is the wrong type for the second type of date. Make a
class, with a unique format on the wire, so that you don't accidentally
get the the two mixed up.
Yes, I deal with dates as in month, day, year and timestamp as in
month, day, year, hour, min, second.
This is exactly my problem, I do use java.util.Date for both. It
seems to me that there should be a strictly CalendarDate class i could
use for the date types and CalendarTimeStamp class for the timestamp
types
To get a real Date class you will have to either:
- use java.sql.Date
- use your own class
- wait for Java 1.7 which I assume will have such a beast
Using a java.sql.Date doesn't help. It still seems to display the
timezone data by default and consequentially switch the time and date
after on a change in timezone.
Almost no matter what you do, then you will have something
that represent the time since 1970.

But you can control how it is formatted. And that is how
you should solve your problem.

Arne

Basically you are saying if I am using the date only fields then the
way to maintain the proper date format is always make sure when I
access/display the date it is in the same timezone that the server is
that loaded it?
....

No, make sure it is *always* treated as a specific time zone, regardless
of the server or anything else. I would force UTC, so that the time zone
offset is zero.

Patricia
.



Relevant Pages

  • Re: how to make dates without timezones?
    ... servers time for both parse and format. ... that letting the client app format using the servers timezone is ... I would store all times on the server as a long in milliseconds since Jan 1, ... You might have to send the client's time zone as a parameter in your RMI request. ...
    (comp.lang.java.programmer)
  • Re: Script to change time zone?
    ... In the first command you can change the time.nist.gov server with your preferred server, or you can have more than one server if you separate them by commas. ... I'm going to need to change the timezone on ... zone in the control panel to the time zone I'm going to need ...
    (microsoft.public.windowsxp.general)
  • Re: how to make dates without timezones?
    ... because the time depends on the timezone. ... servers time for both parse and format. ... that letting the client app format using the servers timezone is ... that the bulk of the work in my app is done on the server and is ...
    (comp.lang.java.programmer)
  • Re: how to make dates without timezones?
    ... Date it automatically assigns the timezone. ... with 0 hours, 0 minutes, 0 seconds and the time zone of the server. ... My application is a client server app using rmi. ...
    (comp.lang.java.programmer)
  • Re: how to make dates without timezones?
    ... because the time depends on the timezone. ... servers time for both parse and format. ... that letting the client app format using the servers timezone is ... that the bulk of the work in my app is done on the server and is ...
    (comp.lang.java.programmer)

Loading