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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:19:13+00:00 2026-05-19T04:19:13+00:00

I have a Date that has been converted to a String to be passed

  • 0

I have a Date that has been converted to a String to be passed to a Java Socket server. An example of this value is 06:19:18p.m. 13/01/2011.

Within the Socket server I’m trying to convert it back to a Date value before writing it to a SQL Database table, but the converted value is NULL. I have also tried writing the value to the SQL database as the original String, but it doesn’t write unless there are no colon, full stop, or forward-slash characters in it.

Is there any way I can get around this? I’m sorry that I can’t view or post the stack trace, as I don’t have admin access to the server I’m running my Jar file on.

My code to convert the String is:

Date date = null;
SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ssa dd/MM/yyyy");
try { 
    date = sdf.parse(timestamp);
} 
catch (ParseException e) {
    e.printStackTrace();
}
  • 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-19T04:19:13+00:00Added an answer on May 19, 2026 at 4:19 am

    I am not sure why you can’t parse correctly but you are thinking all wrong about this. Instead of saving String in the database you should make the column of type TIMESTAMP or DATE. Then you can use getDate() from the JDBC to just get the date object.

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

Sidebar

Related Questions

I have a table that has three different date columns, so I set each
i have a table that has event name and event date. if i want
I have a model of events that has various information such as date, location,
I have a table that has data like below(sorted by date) COL_A | COL_B
I have an application that has a UILabel displaying the current date and time,
Let's say I have a table that has user_id, date, score, and every user
I have a table in an Oracle Database that has, among others, a DATE
I have an application with existing data, that has Zero in the date column.
I have a report that has a default date range (Start Date -> End
I have a script that has been written that I need to change 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.