-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 14 posts ] 
Author Message
 Post subject: Auto deduct 30minute for Date!
PostPosted: Thu Oct 06, 2005 11:31 am 
Beginner
Beginner

Joined: Fri Jun 17, 2005 7:24 am
Posts: 23
The date will run after i save. Why auto deduct 30minutes for the date which before year 1982? How to solve it?


Top
 Profile  
 
 Post subject: Re: Auto deduct 30minute for Date!
PostPosted: Thu Oct 06, 2005 11:32 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
why wrote:
The date will run after i save. Why auto deduct 30minutes for the date which before year 1982? How to solve it?


What are you talking about ?

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 9:17 pm 
Beginner
Beginner

Joined: Fri Jun 17, 2005 7:24 am
Posts: 23
I set the date in the following method and then save it but how come the date in the database is 1980-09-08 23:30:00.171? I am using postgres database.
Code:
Calendar calendar = Calendar.getInstance();
calendar.set(1980,8,9,0,0,0);


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 07, 2005 12:05 am 
Newbie

Joined: Wed Oct 05, 2005 8:22 pm
Posts: 11
Location: Brisbane, Australia
Perhaps it's a daylight savings adjustment.

_________________
Atomic Objects
http://atomic.catchpole.net/

An object environment in which Java objects can be created, linked and taught to relate to one another.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 07, 2005 12:43 am 
Newbie

Joined: Wed Oct 05, 2005 8:22 pm
Posts: 11
Location: Brisbane, Australia
Try "getting" this field on the calendar and see what comes back. You should be able to force it to zero. Dont forget it may correct it on the way back out. Maybe you can use a date class which doesnt have offsets applied.

Even if if you are not in daylight savings time now, it's probably for that period in 1980.

Code:
DST_OFFSET

public static final int DST_OFFSETField number for get and set indicating the daylight savings offset in milliseconds.

This field reflects the correct daylight saving offset value of the time zone of this Calendar if the TimeZone implementation subclass supports historical Daylight Saving Time schedule changes.

_________________
Atomic Objects
http://atomic.catchpole.net/

An object environment in which Java objects can be created, linked and taught to relate to one another.


Top
 Profile  
 
 Post subject: GMT+08:00 - > SGT
PostPosted: Sat Oct 08, 2005 11:19 am 
Beginner
Beginner

Joined: Fri Jun 17, 2005 7:24 am
Posts: 23
I use println to print the date at problem computer.
Tue Sep 09 00:00:00 GMT+08:00 1980

I tried to use other computer. It work but the println is not "GMT+08:00". It is "SGT".

What is that mean?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 08, 2005 7:19 pm 
Newbie

Joined: Wed Oct 05, 2005 8:22 pm
Posts: 11
Location: Brisbane, Australia
A quick google of SGT appears to be the Singapore time zone. One computer is set up with the timezone GMT offset and one is set up SGT as the time zone. If it's Windows, look in Control Panel / Date and Time. If it's unix, I wouldn't know.

You will probably want to find a fix so that it works on all computers all the time. Maybe you can use different date objects which don't apply offsets or reset the offset on Calandar as I suggested.

_________________
Atomic Objects
http://atomic.catchpole.net/

An object environment in which Java objects can be created, linked and taught to relate to one another.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 09, 2005 12:03 am 
Beginner
Beginner

Joined: Fri Jun 17, 2005 7:24 am
Posts: 23
The print out the DST_OFFSET it is zero.
calendar.getTimeZone().getDSTSavings()

I am not clear how to set the offset that u mentioned to zero.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 09, 2005 12:08 am 
Newbie

Joined: Wed Oct 05, 2005 8:22 pm
Posts: 11
Location: Brisbane, Australia
Try..

Code:
        Calendar calendar = Calendar.getInstance();
        calendar.set(1980,8,9,0,0,0);
        calendar.set(Calendar.DST_OFFSET, 0);   


also click "did this solve the problem?" YES, to vote for my wonderful helpfullness :)

_________________
Atomic Objects
http://atomic.catchpole.net/

An object environment in which Java objects can be created, linked and taught to relate to one another.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 09, 2005 12:19 am 
Newbie

Joined: Wed Oct 05, 2005 8:22 pm
Posts: 11
Location: Brisbane, Australia
..but if as you say, it's already zero, this may not help. It may be being applied within the database. Perhaps the database has it's own setting for this.

It's annoying that these offsets occur, but databases need to keep the constant time sequence so that calculations and cut-offs dont get applied incorrectly.

PS. Noone has responded to my posting...
"Persistence layer approaches and big picture arguments."
http://forum.hibernate.org/viewtopic.php?t=948531&highlight=
I thought it was interesting and insightful. Perhaps I'm just craaaazy! :)

CC

_________________
Atomic Objects
http://atomic.catchpole.net/

An object environment in which Java objects can be created, linked and taught to relate to one another.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 09, 2005 12:20 am 
Beginner
Beginner

Joined: Fri Jun 17, 2005 7:24 am
Posts: 23
The computer which printout SGT, in control panel there is "(GMT+08:00 ) Kuala Lumpur, Singapore" but how come printout is SGT?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 09, 2005 12:23 am 
Newbie

Joined: Wed Oct 05, 2005 8:22 pm
Posts: 11
Location: Brisbane, Australia
One is the time zone code, which java knows the name of. One is the name of the cities, which windows uses so you dont have the know what time zone code you are in. They are the same thing. It doesnt matter what they are called.

_________________
Atomic Objects
http://atomic.catchpole.net/

An object environment in which Java objects can be created, linked and taught to relate to one another.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 09, 2005 1:30 am 
Beginner
Beginner

Joined: Fri Jun 17, 2005 7:24 am
Posts: 23
I can sure is not the database cause the problem because i tried to use spring's jdbcTemplate to save it. It work fine. What to do now?????


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 09, 2005 5:25 am 
Newbie

Joined: Wed Oct 05, 2005 8:22 pm
Posts: 11
Location: Brisbane, Australia
Hmm... dunno.. anyone else got any ideas?

_________________
Atomic Objects
http://atomic.catchpole.net/

An object environment in which Java objects can be created, linked and taught to relate to one another.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 14 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.