Very simple question somehow driving me crazy

Posted on 2005-04-12
Last Modified: 2010-04-01
Im brand new to JSP (having cut my teeth on PHP and ASP), Ive got the following on a webpage:


It prints out "APRIL 07, 2005"

what function can I use to make it print out:

April 07, 2005

basically only the first letter of the month is capital?

lcase(obj[i].getDate()) ? Please remember Im a total novice with JSP

Also, is there a list of JSP functions somewhere (like ?
Question by:fox_statton
    LVL 11

    Expert Comment


    Author Comment

    I really want to convert the existing date, rather than generate a new one,

    LVL 1

    Expert Comment

    You should be able to get your date's string representation into String variable:
    somthing like:
    String str = obj[i].getDate().toString();
    You can then try to split the sring and lower-case everything after first character:
    str = str.substring(0,1) + str.substring(1).toLowerCase();

    What is type of obj array?
    LVL 11

    Expert Comment

    In whatever format ur getting just pass that format to SimpleDateFormat and convert it into date and then
    from above link u can convert it into whatever format you want...
      SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
      java.util.Date d = sdf.parse(myDate);
    LVL 1

    Accepted Solution


    You can you java SimpleDateFormat class to format dates in which ever form you want for display purposes. The format() method in this class takes a date object, returns a string in the format specified in the SimpleDateFormat Constructor.

    To solve your problem, you need to do something of this sort....

    java.util.Date toFormat = obj[i].getDate();
    SimpleDateFormat sdf = new SimpleDateFormat("MMMM dd,yyyy);
      String formattedDate = sdf.format(toFormat);
    Catch(Exception e)
    System.out.println("Exception in formatting date object :" + e.toString());

    Hope this solves your problem

    Dilip Kumar

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    netstat -a in AIX unix 8 21
    TreeSet comparator example 7 86
    lessBy10  challenge 15 84
    Using Tomcat as raspberry pi java app server 13 77
    If you're not part of the solution, you're part of the problem.   Tips on how to secure IoT devices, even the dumbest ones, so they can't be used as part of a DDoS botnet.  Use PRTG Network Monitor as one of the building blocks, to detect unusual…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now