• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Retrieving wrong date/time with Timestamp

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 27235
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic