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 1083449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:26:15+00:00 2026-05-16T22:26:15+00:00

Hi i am trying to parse a string into a java.sql.date Here is what

  • 0

Hi i am trying to parse a string into a java.sql.date

Here is what i am doing

private static SimpleDateFormat sdfout = new SimpleDateFormat("yyyy.MM.dd.HH.mm");
          try{
            String date = "2010.09.30.13.18";
        task.setDueDate(new java.sql.Date(sdfout.parse(date).getTime()));
    }

The problem is that i only get the date back. Not the time.

Am i doing this correctly

  • 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-05-16T22:26:16+00:00Added an answer on May 16, 2026 at 10:26 pm

    The code logic is fine, you only need java.sql.Timestamp instead of java.sql.Date. The SQL timestamp represents both the date and time parts, like date in Java. The SQL date represents only the date part.

    See also:

    • Handling timestamps in MySQL using JDBC

    Noted should be that you should prefer java.util.Date over java.sql.Timestamp in the model objects and use the Timestamp only at the very moment when you’re about to set it in a SQL query. This separates the model objects from the JDBC API and improves their portability and reusability.

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

Sidebar

Related Questions

I'm trying to parse this string into java, but I keep getting errors. {id:1,jsonrpc:2.0,result:{limits:{end:3,start:0,total:3},sources:[{file:/media/storage/media/re
I am trying to parse a string into a date in the constructor of
I'm trying to parse a date string into a DateTime variable. I've found out
I'm trying to parse a SHGetSpecialFolderPath into a string, a System::String^ to be precise.
I am trying to parse user entered string like A12, into a Haskell tuple,
I am trying to parse one string to a format yyyy-MM-dd and one to
I'm trying to parse a string to a date field in an android application
I'm trying to parse a int from a String array element. Here is my
I'm trying to parse string representation of date. It looks like 20120306 14:21:35 MSK
I am trying to parse a json string straight into a managed object. The

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.