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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:04:24+00:00 2026-05-27T04:04:24+00:00

I want to parse a time value formatted as 12:34:56 , which comes from

  • 0

I want to parse a time value formatted as "12:34:56", which comes from an external web service, to a Date, Calendar or anything that I can later compare to current time.

The problem is that on Android, DateFormat.parse seems to ignore the user’s default timezone and parse the value as if it was in UTC. Given this code:

DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
String inTime = "12:34:56";
Date time = timeFormat.parse(inTime);
Date now = new Date();

I get the wanted result on my desktop (Java 1.6.0_29):

Thu Jan 01 12:34:56 CET 1970
Mon Nov 21 20:53:04 CET 2011

In other words, the string “12:34:56” is parsed in the default timezone. However, on Android this seems to be parsed in UTC, because it is one hour off:

Thu Jan 01 11:34:56 GMT+0100 1970
Mon Nov 21 20:53:02 GMT+0100 2011

I even tried setting the timezone using timeFormat.setTimeZone(TimeZone.getDefault()), but this does not help. Is there any way to force DateFormat.parse to parse the time in the default (user) timezone on Android, or do I have to convert everything to UTC and back to get it working?

  • 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-27T04:04:25+00:00Added an answer on May 27, 2026 at 4:04 am

    It turns out my device really had some issues with time-zones. I tried running the code on some other devices and it worked as expected.

    I resolved the issue for my phone by installing TimeZone Fixer and updating the timezone information.

    I will leave my code as-is, but I will have to implement some workarounds if the problem turns out to be more common.

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

Sidebar

Related Questions

I am trying to convert a string into date time format. DateTime.Parse(tempfrmBankDetails.dgvBankDetails.SelectedRows[0].Cells[PaymentDate].Value.ToString(),null); This is
I'm attempting to use regexp to parse a search string that from time to
I've made a little forum and I want parse the date on newest posts
I want to parse a config file sorta thing, like so: [KEY:Value] [SUBKEY:SubValue] Now
I want to parse a web page in Groovy and extract all of the
I want to parse the input string and extract the values from it. My
I want to parse out each modified file that is reported during FCIV's verification
I'm reading a date from an Excel cell in Python (using .Value on the
I want to parse date in my page to Javascript's Date . So I
I want to parse data which might contain mixed patterns like 1-4pm 1pm-5pm noon

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.