Results 1 to 3 of 3
  1. #1
    mohammads2 is offline Member
    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0

    Default Date converting for inserting in mysql rdbms

    Hello every body.

    i am trying to insert one row in mysql by java , and i have one field that it's type is date.

    and i have one date string of Georgian date and i want convert that to java.sql.date format for inserting to my bank.

    i am using from this code :

    long epoch = 0;
    epoch = new SimpleDateFormat("yyyy/mm/dd").parse("2012/11/26").getTime();
    Date d = new Date(epoch);

    this is work but when i try to use from d object it's value is 2012.01.26.

    can anyone help me?

  2. #2
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,923
    Rep Power
    19

    Default Re: Date converting for inserting in mysql rdbms

    'mm' is minutes.
    'MM' is months.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    mohammads2 is offline Member
    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0

    Default Re: Date converting for inserting in mysql rdbms

    Many thanks sir.

    solved.

Similar Threads

  1. Replies: 3
    Last Post: 10-18-2012, 03:00 PM
  2. Replies: 5
    Last Post: 02-16-2012, 09:26 AM
  3. Compare Mysql date with current date
    By gioarvan in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 04-24-2011, 05:19 PM
  4. converting string (GMT date) to date in US time.
    By JRuyechan in forum New To Java
    Replies: 1
    Last Post: 10-15-2010, 07:07 AM
  5. PreparedStatement - inserting date
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-11-2008, 08:44 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •