DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links