Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8141001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:21:01+00:00 2026-06-06T12:21:01+00:00

I m writing a program which involves converting java.util.Date to java.sql.Date… I’ve done it

  • 0

I m writing a program which involves converting java.util.Date to java.sql.Date…

I’ve done it using getTime() method…

           java.util.Date dt = new java.util.Date();
           java.text.DateFormat df = new java.text.SimpleDateFormat("dd/MM/yyyy");
           dt=df.parse("06/12/0785");
           java.sql.Date sqldate = new java.sql.Date(dt.getTime());
           System.out.print("\n\n\n "+dt.getTime()+"    "+sqldate);

I m getting a negative value for dt.getTime() and the value is correct for sqldate…

The doubt i’ve is

           `Is it safe to use negative seconds as epoch or is it vulnerable to bugs while implementing it in database in any way.....???

AND

It’s printing wrong date for sqldate on setting date as 00/00/0000 instead of the one mentioned in the example….what might be the cause……and does there lie a solution…….???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T12:21:03+00:00Added an answer on June 6, 2026 at 12:21 pm

    If you parse a “00” as month, it will be regarded as December. The day “00” is the last day of the previous month, so the combinations is parsed as the 30th of November. As for the zero year, see Year 0000 in java. Negative values for .getTime() are no problem at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a small C++ program, which involves starting a .exe process with
I'm currently writing a program which interacts with I/O devices and needed a method
I am writing a program in C++ which involves parsing a lot of text
I'm writing a program which monitors Java Applications. I'd like to monitor the state
I'm writing program which captures audio in C# using DirectShow library and writes it
I'm writing a program which has both an ASP.NET configuration system and a Silverlight
I am writing a program which if I compile on a Suse 10 32-bit
I'm writing a program which will use scan conversion on triangles to fill in
I'm writing a program which will allow to load a specific managed .DLL file
I'm writing a C++ program which needs to be able to read a complex

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.