Results 1 to 2 of 2
  1. #1
    bigmac15 is offline Member
    Join Date
    Jun 2011
    Posts
    3
    Rep Power
    0

    Default Date() class to get current date

    Ive written Date lastUpdated = new Date() but that gets me:
    Java Code:
    Tue Jun 28 13:59:28 EDT 2011
    Im looking for a simplier format more specifically this one:
    Java Code:
    2010-09-30
    Ive search google for found methods where i need to use SimpleDateFormat is that the only way of doing this because my prof wants us to use Date()

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default

    SimpleDateFormat was written for problems such as this...and you essentially use it to create an Instance of Date with the parse method

Similar Threads

  1. Replies: 5
    Last Post: 02-16-2012, 09:26 AM
  2. 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
  3. Compare date input to database with current date
    By hungleon88 in forum Advanced Java
    Replies: 2
    Last Post: 11-25-2008, 08:10 AM
  4. Difference between current date and anothe date
    By vijay balusamy in forum New To Java
    Replies: 1
    Last Post: 04-16-2008, 04:15 PM
  5. how to get the current date and time
    By valery in forum New To Java
    Replies: 1
    Last Post: 08-03-2007, 06: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
  •