Re: how to make dates without timezones?
- From: Patricia Shanahan <pats@xxxxxxx>
- Date: Sat, 21 Feb 2009 13:47:19 -0800
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:Almost no matter what you do, then you will have somethingepicwinter wrote:Using a java.sql.Date doesn't help. It still seems to display theOn Feb 21, 11:04 am, Mark Space <marksp...@xxxxxxxxxxxxxx> wrote:To get a real Date class you will have to either:epicwinter wrote:Yes, I deal with dates as in month, day, year and timestamp as inI have tried this too. It works in some respects but creates newThis implies to me that you have two different types of dates, and you
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.
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.
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
- use java.sql.Date
- use your own class
- wait for Java 1.7 which I assume will have such a beast
timezone data by default and consequentially switch the time and date
after on a change in timezone.
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
.
- References:
- how to make dates without timezones?
- From: epicwinter
- Re: how to make dates without timezones?
- From: Arne Vajhøj
- Re: how to make dates without timezones?
- From: epicwinter
- Re: how to make dates without timezones?
- From: Mark Space
- Re: how to make dates without timezones?
- From: epicwinter
- Re: how to make dates without timezones?
- From: Arne Vajhøj
- Re: how to make dates without timezones?
- From: epicwinter
- Re: how to make dates without timezones?
- From: Arne Vajhøj
- Re: how to make dates without timezones?
- From: epicwinter
- how to make dates without timezones?
- Prev by Date: Re: How to enable JIT?
- Next by Date: Re: how to make dates without timezones?
- Previous by thread: Re: how to make dates without timezones?
- Next by thread: Re: how to make dates without timezones?
- Index(es):
Relevant Pages
|
Loading