Results 1 to 3 of 3
  1. #1
    hungleon88 is offline Member
    Join Date
    Aug 2008
    Posts
    41
    Rep Power
    0

    Default Compare date input to database with current date

    How can we Compare the date we input in the textfield to insert to database with the current date ?
    please Hint me !
    Thanks a lot !

  2. #2
    xcallmejudasx's Avatar
    xcallmejudasx is offline Senior Member
    Join Date
    Oct 2008
    Location
    Houston, TX & Flint, MI
    Posts
    609
    Rep Power
    7

    Default

    check the Calender api and define textfield. If you're using a String variable you need to format it the same way the API is formatted and could probably use .equalsIgnoreCase() to check if their the same. If your using a GUI and the input is of type Text then just textVariable.getText() will return a string

  3. #3
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Use SimpleDateFormat to parse the date String into an actual Date, then use a PreparedStatement and setDate with that Date object to enter the Date into your query.

    If you are asking for the SQL statement itself, then please find an SQL forum.

Similar Threads

  1. Replies: 12
    Last Post: 04-18-2009, 01:58 AM
  2. Difference between current date and anothe date
    By vijay balusamy in forum New To Java
    Replies: 1
    Last Post: 04-16-2008, 05:15 PM
  3. Inserting current date into a DB table
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-15-2008, 09:38 AM
  4. Getting current date using dual (Oracle)
    By Java Tip in forum Java Tip
    Replies: 1
    Last Post: 02-13-2008, 05:46 PM
  5. how to get the current date and time
    By valery in forum New To Java
    Replies: 1
    Last Post: 08-03-2007, 07:05 PM

Posting Permissions

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