Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Java converting Date to 100 years back

  1. #1
    Junior Member
    Join Date
    Apr 2021
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Java converting Date to 100 years back

    Hi All,

    I am pretty new to Java. I had worked on Java a bit around 12 years ago, so please bear with any stupid questions.

    We have a Project which is in house built for ETL Purpose. Unfortunately the Developer isnt with organization anymore and now the responsibility has come upon me.

    The issue we are facing is whenever the Input date is format "DD-MON-YY" ex "10-Mar-21" the Java is converting the date to "1921-03-10 00:00:00.000"

    The flow of Project is we provide a SQL Query which is used to read data from a source database
    Select column1 from table1

    The few processing's are done and then a SQL Statement is prepared to insert into destination database
    Insert into DestTable1(Column1)
    Values('1921-03-10 00:00:00.000')

    I think whenever the Year is supplied in two digits we are facing this issue.

    Can anyone please let me know what might be the reason for this 100 years back conversion and where can i look in code for this and what would i have do to fix this?

    Many thanks in advance.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java converting Date to 100 years back

    I don't know SQL. I suggest asking this question on this forum where there are people that know SQL and java:
    https://coderanch.com/forums
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following User Says Thank You to Norm For This Useful Post:

    manjunathcbhat (April 12th, 2021)

  4. #3
    Junior Member
    Join Date
    Apr 2021
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Java converting Date to 100 years back

    Sure, thank you so much

  5. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java converting Date to 100 years back

    Continued here: https://coderanch.com/t/741388/java/...ing-Date-years
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. [SOLVED] Converting a SecretKey to String and back again
    By Lora_91 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: February 20th, 2014, 05:20 AM
  2. Java Date Format in Date Object
    By Ashr Raza in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 13th, 2012, 10:47 AM
  3. [SOLVED] Issue with converting a string to a date
    By dave_nj in forum What's Wrong With My Code?
    Replies: 15
    Last Post: May 2nd, 2012, 02:14 PM
  4. been many years since I programmed in java
    By chicken_council in forum What's Wrong With My Code?
    Replies: 5
    Last Post: December 11th, 2011, 06:29 AM