date formatting in java


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: date formatting in java

  1. #1
    Join Date
    Mar 2005
    Location
    London
    Posts
    18

    date formatting in java

    Hi there. Sure I'm being dumb but can't figure this out!

    I'm bringing back a date field from my database via stored procedure. For some reason though the month information is not being displayed. The field in question is a datetime field in a Sybase database and in this example contains the value "Mar 3 2003 12:00AM"

    Here's the code I use to output.

    SimpleDateFormat datOutput = new SimpleDateFormat( "dd/mm/yyyy" );
    System.out.println(datOutput.format(rs.getDate(25)));

    What comes out is "03/00/2003"

    Does anyone have any idea why the month info is not being displayed?

    many thanks!

  2. #2
    Join Date
    Mar 2004
    Posts
    635
    I believe "mm" should be capitalized. "MM"

    yup, month is MM and minutes is mm

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center