Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6008281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:48:08+00:00 2026-05-23T01:48:08+00:00

In my web application I am currently using a custom DateUtil class to convert

  • 0

In my web application I am currently using a custom DateUtil class to convert java.util.Date to String and vice versa. I am doing this only to convert to a default pattern dd/MM/YYYY. This is the only date format the entire application needs. Now there are lot of input fields, where date values are selected using a calender. I am currently converting this String value to java.util.Date using the DateUtil package before posting to database and then while displaying this date in jsp I am using jstl <fmt:formateDate> tag to convert format to dd/MM/YYYY.

Is there any way that I can set a default date pattern for the web-application. Atleast new Date().toString() should get printed in default(dd/MM/YYYY) format.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:48:09+00:00Added an answer on May 23, 2026 at 1:48 am

    If I understood correctly, this is the way it goes now:

    1. Your user sends a date to your
      server as a String through a form
      field.
    2. You parse the String to a Date
      object (I’m guessing you do it with
      SimpleDateFormat or similar).
    3. You display the Date object’s date
      back to the user as a string,
      formatted with JSTL tags.

    And you want it to go something like this:

    1. Same as before
    2. Same as before
    3. You display the Date object’s date back to the user using the Date object’s toString() method.

    I’d say these are nearly similar in effort, but I’d also be inclined to use the JSTL formatter when displaying the dates.

    I’d suggest that you stay with your current implementation. Just move your default date pattern to a class as a constant:

    public class WebConstants {
        public static final String DEFAULT_DATE_FORMAT = "dd/MM/yyyy";
    }
    

    And use it with the formatting:

    <fmt:formatDate value="${mybean.date}" pattern="<%=WebConstants.DEFAULT_DATE_PATTERN%>" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.