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

  • SEARCH
  • Home
  • 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 7925685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:24:35+00:00 2026-06-03T18:24:35+00:00

Could somebody tell me how can I get the default date and time format

  • 0

Could somebody tell me how can I get the default date and time format pattern(String) for specified locale(or default locale).

What I already found (Could be useful for somebody else):

  1. How to get default locale.

    Locale currentLocale= Locale.getDefault();
    System.out.print(currentLocale.toString());
    
    Result is "en_US"
    
  2. How to get decimal separator.

    DecimalFormatSymbols decimalFormatSymbols =
                                         new DecimalFormatSymbols(currentLocale);
    System.out.print(decimalFormatSymbols.getDecimalSeparator());
    
    Result is "."
    
  3. How to get the default Date and Time format pattern (String);

    (do something)
    System.out.print(something);
    And got at output something like this: "dd/mm/yyyy" or "hh:mm:ss".. 
                                 or other values for specified locale.
    

Thanks a lot.

UPD:
Found solution:

SimpleDateFormat simpleDateFormat = new SimpleDateFormat();
String dateLocalizedFormatPattern = simpleDateFormat.toLocalizedPattern();

The result of System.out.print(dateLocalizedFormatPattern) 
                                             on my device is "M/d/yy h:mm a".
  • 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-06-03T18:24:36+00:00Added an answer on June 3, 2026 at 6:24 pm

    Update

    As Russian Bear mentions in his update to the question there is a toLocalizedPattern() method in SimpleDateFormat that returns the format string.

    Original answer

    SimpleDateFormatuses the following code in it’s private constructor:

    ...
    ResourceBundle r = LocaleData.getDateFormatData(loc);
    if (!isGregorianCalendar()) {
        try {
            dateTimePatterns = r.getStringArray(getCalendarName() + ".DateTimePatterns");
        } catch (MissingResourceException e) {
        }
    }
    if (dateTimePatterns == null) {
        dateTimePatterns = r.getStringArray("DateTimePatterns");
    }
    ...
    

    So the actual format strings seems to be in a ResourceBundleaccessed via the LocaleData.getDateFormatData()method.

    Unfortunately the LocaleDataclass is a part of the internal sun.util.resources package.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Could somebody tell me how can I convert byte[] to ArrayList by using C#
Could somebody please tell me how I can configure iReport 3.5 (nb) to use
Could somebody tell me how I can make a text that the player can
Could somebody tell me how can I remove input filter chooser from comment form
Could somebody tell me the difference between: int *p; p=(int*)malloc(10*sizeof(int)); free(p); or int *p;
I'm implementing now CPU schedule algorithms FCFS, SJF and Round Robin. Could somebody tell
Could somebody please help me get Clang up and running? (I don't have 3.2)
Could somebody please tell me what is Memory Page Out Rate. I have seen
Could somebody tell me where would the execution log be stored when using the
Can somebody please tell me how to set the cursor position in an MFC

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.