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 7058983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:10:40+00:00 2026-05-28T04:10:40+00:00

I am using this simple date format SimpleDateFormat sdf = new SimpleDateFormat(yyyy-MM-dd HH:mm:ss.SSS Z);

  • 0

I am using this simple date format

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS Z");

the problem is when I use this it takes too long to convert the time, in logcat I see something like this

I/Resources( 4284): Loaded time zone names for en in 272ms.
I/Resources( 4284): Loaded time zone names for en in 194ms.
I/Resources( 4284): Loaded time zone names for en in 112ms.
I/Resources( 4284): Loaded time zone names for en in 111ms.
I/Resources( 4284): Loaded time zone names for en in 113ms.
I/Resources( 4284): Loaded time zone names for en in 127ms.
I/Resources( 4284): Loaded time zone names for en in 253ms.
I/Resources( 4284): Loaded time zone names for en in 110ms.
I/Resources( 4284): Loaded time zone names for en in 154ms.
I/Resources( 4284): Loaded time zone names for en in 112ms.

How can I use simple date formater but to speed the things up, I do not want to take ~150ms for every conversion…

Does anybody had this problem before ?

  • 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-28T04:10:41+00:00Added an answer on May 28, 2026 at 4:10 am

    This is due to the lazy initialization of the timezone zone strings. Only the first
    call will take this long. If the SimpleDateFormat is used again afterwards it’s
    loaded from cache and shouldn’t take that long anymore.

    Before this was changed it was done when the class was loaded and thus the start of
    an activity took those 2-3 seconds longer. This had a much worse impact on the user
    experience than if it takes those seconds when it’s actually used the first time. The
    problem is that there’s no way right now to circumvent this issue due to the design
    of the SimpleDateFormat api. Only faster phones might fix this by just taking less
    time to collect those strings.

    The caching happens in the DateFormatSymbols that SimpleDateFormat is using. By
    reusing that instance it’s possible to only have to load the stings once (for the
    same loale). You could also create that Instance in a thread at the startup of the
    activity so that it’s already cached once it’s used. To init the strings just call
    .hashCode() which does force initialize the cache. A bit faster but less simple would
    be to serialize the instance. This also forces the cache to be initialized.

    In the interim, consider using AsyncTask to “warm up” SimpleDateFormat in your process before you need it. Just parse some date in the AsyncTask doInBackground() to get it to load the timezones sometime when it will not impact the user so much. Once initialized in your process, SimpleDateFormat will run quickly until your process is terminated.

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

Sidebar

Related Questions

I am using this code to parse a Date. SimpleDateFormat formatter = new SimpleDateFormat(MM/dd/yyyy);
Am having problem in using simple date format for this: having date as 12/13/2011
Let's consider the following code: SimpleDateFormat sdf = new SimpleDateFormat(HH:mm:ss dd/MM/yyyy, Locale.US); long start
This should hopefully be a simple one. When using a date time picker in
Right now I am using this code Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf =
I am trying to convert a string to proper date format using Java's SimpleDateFormat
I am using simple date format in my app in following way in the
Is it possible to format a date time in Java using the SimpleDateFormat class
I'm using this simple regular expression to validate a hex string: ^[A-Fa-f0-9]{16}$ As you
I'm using this simple function: def print_players(players): tot = 1 for p in players:

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.