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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:36:38+00:00 2026-06-02T13:36:38+00:00

I have a timestamp field of Oracle in Java String String strDate = 24.12.12

  • 0

I have a timestamp field of Oracle in Java String

String strDate = “24.12.12 03:30:00,000”; //Timestamp field of Oracle

I need to convert it to Java.util.Date.

Please tell me a way to do this.

Note: I don’t have first two digits for the year, how can java understand that this is year 1912 or 2012 and so on.

  • 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-02T13:36:39+00:00Added an answer on June 2, 2026 at 1:36 pm

    The class you want is SimpleDateFormat. You’ll create a pattern that matches your expected input, and parse it. Here’s an example, though it may be incorrect in some places (I used 0-23 hour, maybe you want 1-24, etc.)

    String strDate = "24.12.12 03:30:00,000";
    SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yy HH:mm:ss,SSS");
    Date date = sdf.parse(strDate);
    

    Regarding your 1912 vs 2012 problem, Java will make some assumptions when there are only 2 digits. Specifically:

    For parsing with the abbreviated year pattern (“y” or “yy”),
    SimpleDateFormat must interpret the abbreviated year relative to some
    century. It does this by adjusting dates to be within 80 years before
    and 20 years after the time the SimpleDateFormat instance is created.

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

Sidebar

Related Questions

I have a timestamp field in Oracle db with some date and time. I
I have a strange format that I need to convert to an Oracle Timestamp
I have an SQL timestamp field and I need to group it by month
I have an Oracle DB with a timestamp field in it. What is the
I have created a timestamp field in mysql, where the date gets stored as
I have a custom UserType which stores a date/time value in a TIMESTAMP field
A have a JPA entity that has timestamp field and is distinguished by a
I want to add expire TIMESTAMP in DB table. I have one field timestamp
I have a model with a version field - autocreate timestamp. When a model
Say I have a 'user_log' table with the following field: id user_id status_text timestamp

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.