Re: how to make dates without timezones?



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?

This sounds like an absolute nightmare from a maintenance point of
view. There must be a more pragmatic way to solve this problem
.



Relevant Pages

  • Re: how to make dates without timezones?
    ... class, with a unique format on the wire, so that you don't accidentally ... seems to me that there should be a strictly CalendarDate class i could ... use for the date types and CalendarTimeStamp class for the timestamp ... after on a change in timezone. ...
    (comp.lang.java.programmer)
  • Re: how to make dates without timezones?
    ... seems to me that there should be a strictly CalendarDate class i ... >>> after on a change in timezone. ... > way to maintain the proper date format is always make sure when I ... You can convert that for display, to local time, server time, UTC, or any other time zone you want, when you want to display it. ...
    (comp.lang.java.programmer)
  • Re: Python 2.5.1 broken os.stat module
    ... |>> when DST starts and also when DST ends, even though the file has NOT ... Windows is not claiming ... | That local textual representation of the modification timestamp is what ... And without a timezone attached, ...
    (comp.lang.python)
  • SUMMARY: Re: DST Patch for Solaris 6 and 7
    ... Sun has an info page at http://www.sun.com/dst/ covering ... you need to be aware of your timezone. ... POSIX timezone format. ... If you use the patch from Terix http://terix.com/dst_registration.htm ...
    (SunManagers)
  • update: timezone offset calc and date formatting
    ... a few days ago I posted on this list about timezone offset calculations. ... Apache uses it's own date format, ... The main performance gain is in the algorithm for calculating the timezone ...
    (comp.lang.perl.misc)