×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

CURRENT_DATE not so current, help.

CURRENT_DATE not so current, help.

CURRENT_DATE not so current, help.

(OP)
In my Java app, I created a simple pool of Connection objects to my PostgreSQL database, and I grab them when needed. But I'm having a problem with dates. When I start the server (Jetty) and insert some records with date fields set to CURRENT_DATE (timestamps set to CURRENT_TIMESTAMP), everything is fine. But if I leave the app running and come back to it the next day, it will insert incorrect dates and timestamps (they will be many hours behind the actual date/time). But if I psql into Postgres and select CURRENT_DATE or CURRENT_TIMESTAMP, the current date or timestamp is displayed. If I shut down and restart the server, the correct date/timestamp will be displayed. It only gets out of whack when I hold the Connection objects for long periods of time, and apparently only dates inserted on those old Connections (and not through psql) will be incorrect. Does anyone have a clue as to what is going on here? Am I wrong to be holding these Connection objects the way I am? This is the only problem I've noticed so far with this approach.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close