• Post Reply Bookmark Topic Watch Topic
  • New Topic

Retrieving wrong date/time with Timestamp  RSS feed

 
Gustavo Santos
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyeone,

I'm stuck with it trying to figure out what's going on and I thought somebody in here could help me out...




When I convert it to Timestamp I still get a different time than the timezone I've specified:

2010-01-18T13:29:57.864-02:00

2010-01-18 10:29:57.864
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What class is DateTime? I'm not familiar with it and I can't find it. I know java.util.Date, java.sql.Date, java.sql.Time, java.sql.Timestamp but not DateTime
 
W. Joe Smith
Ranch Hand
Posts: 710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouter Oet wrote:What class is DateTime? I'm not familiar with it and I can't find it. I know java.util.Date, java.sql.Date, java.sql.Time, java.sql.Timestamp but not DateTime


I was having a similar problem. I searched the JavaDocs but couldn't find a DateTime class...
 
Gustavo Santos
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry guys, I think I forgot to mention that I'm using Joda Time which is where I get the DateTime class from.

http://joda-time.sourceforge.net/api-release/index.html
 
Paul Clapham
Sheriff
Posts: 22819
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know Joda Time, but here's what I see in that code. You have one object which is a kind of date. You assign the São Paulo time zone to it. Next you create a second object which is also a kind of date, but you don't assign the São Paulo time zone to it. Therefore its time zone is whatever your default time zone is, or whatever the default time zone for a Joda object is. Not the same time zone? Then you shouldn't be surprised that they appear differently.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!