This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes java Date  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "java Date  " Watch "java Date  " New topic

java Date

Satyam Jaiswal

Joined: Jan 17, 2007
Posts: 1
I have a java standalone application, It uses Date dt = new Date(); for getting current date and store it in datebase. But sometimes it stores Date like 2021-08-27 17:53:28, 2012-05-28 21:00:17, 3300-12-15 15:25:46, 3006-12-02 05:45:55 or sometimes fails to store in database while trying to save 30062007-12-02 05:45:55.
It happens very rarely, so fail to distinguish the problem.
Please help me out if anybody had this problem or have something on the mind.

David O'Meara

Joined: Mar 06, 2001
Posts: 13459

"Satyam ecstasy",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted, often without warning

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14602

It sounds like you have a bug somewhere in your code that stores or retrieves the date in the database.

Without more details (and perhaps a code listing of your code), it is very hard to give you any useful answer.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: java Date