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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:25:06+00:00 2026-06-08T10:25:06+00:00

In my application I need to convert data to location times. I have java

  • 0

In my application I need to convert data to location times. I have java Date and TimeZoneId

When I get data from service – it comes in as UTC and I get time zone as well. Need to convert into that time zone’s time. Function I created:

 private static Date getDateConvertedToTimeZone(Date utcDate, String timeZoneId)
    {
        TimeZone timeZone = TimeZone.getTimeZone(timeZoneId);
        if (timeZone.getID().equalsIgnoreCase(timeZoneId))
        {
            Log.d(LOG_TAG, "Good: " + timeZoneId + " " + Long.toString(utcDate.getTime()));
            return new Date(utcDate.getTime() + timeZone.getRawOffset() + (timeZone.inDaylightTime(utcDate) ? timeZone.getDSTSavings() : 0));
        }

        Log.d(LOG_TAG, "Bad?: " + timeZoneId + " " + Long.toString(utcDate.getTime()));
        LogData.d(LOG_TAG, "getDateConvertedToTimeZone bad time zone: " + timeZoneId, LogData.Priority.None);
        return utcDate;

    }

Simple? Right. Just grab time zone by ID and do some math on Date object. This is what I thought… When I parse data function called repeatedly and here is output:

07-24 21:31:06.038: DEBUG/com.me.data.TripData(18886): Good: MST 1319896800000
07-24 21:31:06.042: DEBUG/com.me.data.TripData(18886): Good: MST -2208963600000
07-24 21:31:06.053: DEBUG/com.me.data.TripData(18886): Bad?: PST 1320949800000
07-24 21:31:06.057: DEBUG/com.me.data.TripData(18886): Bad?: CST 1320685200000
07-24 21:31:06.061: DEBUG/com.me.data.TripData(18886): Bad?: CST -2208967200000
07-24 21:31:06.073: DEBUG/com.me.data.TripData(18886): Bad?: CST 1320645600000
07-24 21:31:06.077: DEBUG/com.me.data.TripData(18886): Good: EST 1320350400000
07-24 21:31:06.081: DEBUG/com.me.data.TripData(18886): Good: EST -2208970800000
07-24 21:31:06.085: DEBUG/com.me.data.TripData(18886): Good: EST -2208970800000
07-24 21:31:06.093: DEBUG/com.me.data.TripData(18886): Bad?: CST 1321268400000
07-24 21:31:06.096: DEBUG/com.me.data.TripData(18886): Bad?: PST 1320957000000
07-24 21:31:06.108: DEBUG/com.me.data.TripData(18886): Bad?: PST -2208960000000
07-24 21:31:06.116: DEBUG/com.me.data.TripData(18886): Bad?: PST 1321542000000
07-24 21:31:06.120: DEBUG/com.me.data.TripData(18886): Good: MST 1321500600000
07-24 21:31:06.124: DEBUG/com.me.data.TripData(18886): Bad?: CST 1321286400000
07-24 21:31:06.128: DEBUG/com.me.data.TripData(18886): Bad?: CST -2208967200000
07-24 21:31:06.135: DEBUG/com.me.data.TripData(18886): Good: EST 1321981200000
07-24 21:31:06.139: DEBUG/com.me.data.TripData(18886): Bad?: CST 1321884000000
07-24 21:31:06.143: DEBUG/com.me.data.TripData(18886): Bad?: PST 1321646400000
07-24 21:31:06.151: DEBUG/com.me.data.TripData(18886): Bad?: PST -2208960000000
07-24 21:31:06.159: DEBUG/com.me.data.TripData(18886): Bad?: CST 1322485200000
07-24 21:31:06.163: DEBUG/com.me.data.TripData(18886): Good: EST 1321966800000
07-24 21:31:06.163: DEBUG/com.me.data.TripData(18886): Good: EST -2208970800000
07-24 21:31:06.175: DEBUG/com.me.data.TripData(18886): Bad?: PST 1322595000000
07-24 21:31:06.178: DEBUG/com.me.data.TripData(18886): Bad?: CST 1322244000000
07-24 21:31:06.182: DEBUG/com.me.data.TripData(18886): Bad?: CST -2208967200000
07-24 21:31:06.194: DEBUG/com.me.data.TripData(18886): Bad?: PST 1322755200000
07-24 21:31:06.194: DEBUG/com.me.data.TripData(18886): Bad?: PST 1322683440000
07-24 21:31:06.206: DEBUG/com.me.data.TripData(18886): Bad?: PST -2208960000000
07-24 21:31:06.218: DEBUG/com.me.data.TripData(18886): Good: EST 1323190800000
07-24 21:31:06.218: DEBUG/com.me.data.TripData(18886): Good: EST 1323176400000
07-24 21:31:06.221: DEBUG/com.me.data.TripData(18886): Bad?: PST 1322845200000
07-24 21:31:06.229: DEBUG/com.me.data.TripData(18886): Bad?: CST 1323356400000
07-24 21:31:06.233: DEBUG/com.me.data.TripData(18886): Good: EST 1323212400000
07-24 21:31:06.237: DEBUG/com.me.data.TripData(18886): Good: EST 1323194400000
07-24 21:31:06.241: DEBUG/com.me.data.TripData(18886): Good: EST 1323183600000
07-24 21:31:06.245: DEBUG/com.me.data.TripData(18886): Good: EST -2208970800000
07-24 21:31:06.311: DEBUG/com.me.data.TripData(18886): Bad?: PST 1323705600000
07-24 21:31:06.319: DEBUG/com.me.data.TripData(18886): Bad?: CST 1323351000000
07-24 21:31:06.323: DEBUG/com.me.data.TripData(18886): Bad?: CST -2208967200000
07-24 21:31:06.331: DEBUG/com.me.data.TripData(18886): Good: EST 1324054800000
07-24 21:31:06.335: DEBUG/com.me.data.TripData(18886): Good: EST 1324040400000
07-24 21:31:06.339: DEBUG/com.me.data.TripData(18886): Bad?: CST 1323961200000
07-24 21:31:06.343: DEBUG/com.me.data.TripData(18886): Bad?: PST 1323730800000
07-24 21:31:06.346: DEBUG/com.me.data.TripData(18886): Bad?: PST -2208960000000
07-24 21:31:06.354: DEBUG/com.me.data.TripData(18886): Bad?: CST 1324303200000
07-24 21:31:06.358: DEBUG/com.me.data.TripData(18886): Good: EST 1324062000000
07-24 21:31:06.362: DEBUG/com.me.data.TripData(18886): Good: EST -2208970800000
07-24 21:31:06.370: DEBUG/com.me.data.TripData(18886): Bad?: CST 1324603800000
07-24 21:31:06.374: DEBUG/com.me.data.TripData(18886): Bad?: PST 1324306800000
07-24 21:31:06.378: DEBUG/com.me.data.TripData(18886): Bad?: PST -2208960000000
07-24 21:31:06.385: DEBUG/com.me.data.TripData(18886): Good: EST 1324962000000
07-24 21:31:06.389: DEBUG/com.me.data.TripData(18886): Bad?: CST 1324620000000
07-24 21:31:06.393: DEBUG/com.me.data.TripData(18886): Bad?: CST -2208967200000
07-24 21:31:06.405: DEBUG/com.me.data.TripData(18886): Bad?: CST 1325163600000
07-24 21:31:06.413: DEBUG/com.me.data.TripData(18886): Good: EST 1324962000000
07-24 21:31:06.413: DEBUG/com.me.data.TripData(18886): Good: EST -2208970800000
07-24 21:31:06.421: DEBUG/com.me.data.TripData(18886): Bad?: CST 1325768400000
07-24 21:31:06.425: DEBUG/com.me.data.TripData(18886): Good: EST 1325633400000
07-24 21:31:06.428: DEBUG/com.me.data.TripData(18886): Good: EST -2208970800000
07-24 21:31:06.436: DEBUG/com.me.data.TripData(18886): Good: EST 1325599200000
07-24 21:31:06.440: DEBUG/com.me.data.TripData(18886): Good: EST 1325178000000
07-24 21:31:06.444: DEBUG/com.me.data.TripData(18886): Good: EST -2208970800000
07-24 21:31:06.448: DEBUG/com.me.data.TripData(18886): Bad?: PST 1326290400000
07-24 21:31:06.456: DEBUG/com.me.data.TripData(18886): Bad?: CST 1325829600000
07-24 21:31:06.460: DEBUG/com.me.data.TripData(18886): Bad?: CST -2208967200000
07-24 21:31:06.468: DEBUG/com.me.data.TripData(18886): Good: MST 1326178800000
07-24 21:31:06.471: DEBUG/com.me.data.TripData(18886): Bad?: PST 1326121200000
07-24 21:31:06.475: DEBUG/com.me.data.TripData(18886): Bad?: PST -2208960000000
07-24 21:31:06.483: DEBUG/com.me.data.TripData(18886): Good: EST 1326603600000
07-24 21:31:06.487: DEBUG/com.me.data.TripData(18886): Good: MST 1326265200000
07-24 21:31:06.491: DEBUG/com.me.data.TripData(18886): Good: MST -2208963600000
07-24 21:31:06.499: DEBUG/com.me.data.TripData(18886): Good: EST 1326801600000
07-24 21:31:06.507: DEBUG/com.me.data.TripData(18886): Good: EST 1326690060000
07-24 21:31:06.510: DEBUG/com.me.data.TripData(18886): Good: EST -2208970800000
07-24 21:31:06.518: DEBUG/com.me.data.TripData(18886): Bad?: PST 1327064400000
07-24 21:31:06.522: DEBUG/com.me.data.TripData(18886): Good: MST 1327019400000
07-24 21:31:06.526: DEBUG/com.me.data.TripData(18886): Bad?: CST 1326837600000
07-24 21:31:06.530: DEBUG/com.me.data.TripData(18886): Bad?: CST 1326834060000
07-24 21:31:06.585: DEBUG/com.me.data.TripData(18886): Good: EST -2208970800000
07-24 21:31:06.608: DEBUG/com.me.data.TripData(18886): Bad?: CST 1327672800000
07-24 21:31:06.616: DEBUG/com.me.data.TripData(18886): Good: EST 1327496400000
07-24 21:31:06.620: DEBUG/com.me.data.TripData(18886): Good: EST -2208970800000
07-24 21:31:06.628: DEBUG/com.me.data.TripData(18886): Good: EST 1327467600000
07-24 21:31:06.632: DEBUG/com.me.data.TripData(18886): Good: MST 1327042800000
07-24 21:31:06.632: DEBUG/com.me.data.TripData(18886): Bad?: PST -2208960000000
07-24 21:31:06.643: DEBUG/com.me.data.TripData(18886): Good: MST 1327926600000
07-24 21:31:06.647: DEBUG/com.me.data.TripData(18886): Bad?: CST 1327616100000
07-24 21:31:06.651: DEBUG/com.me.data.TripData(18886): Bad?: CST -2208967200000
07-24 21:31:06.659: DEBUG/com.me.data.TripData(18886): Good: EST 1328245200000
07-24 21:31:06.663: DEBUG/com.me.data.TripData(18886): Good: MST 1327906800000
07-24 21:31:06.667: DEBUG/com.me.data.TripData(18886): Good: MST -2208963600000
07-24 21:31:06.678: DEBUG/com.me.data.TripData(18886): Good: EST 1327060800000
07-24 21:31:06.678: DEBUG/com.me.data.TripData(18886): Bad?: CST 1327060800000
07-24 21:31:06.682: DEBUG/com.me.data.TripData(18886): Bad?: CST 1327060800000
  • 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-08T10:25:08+00:00Added an answer on June 8, 2026 at 10:25 am

    Are you using 3 letter time zone identifiers ? This is not supported in Andorid.

    See Documentation

    Other than the special cases “UTC” and “GMT” (which are synonymous in this context, both corresponding to UTC), Android does not support the deprecated three-letter time zone IDs used in Java 1.1.

    you’re expected to use

    Olson name of the form Area/Location, such as America/Los_Angeles. The
    getAvailableIDs() method returns the supported names.

    You also can use the GMT+05:00 syntax.

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

Sidebar

Related Questions

I need to get Json data from a C# web service. I know there
In my application i need to get some data from server using http. The
In the java web application need to select the file from server and print
I need to include about 1 MByte of data in a Java application, for
I need convert image to Data URL (embedding Image) in the Win-application for HTML
On my MVVM Silverlight application I need to call Domain service function to get
I need to convert my WPF application, which has a Ribbon , to use
I am writting a VB.Net application. I need to be able to convert either
The application need write file's last modification date. void Dater(String DateFile) { File file
In our enterprise application we need to attach files to a document. We have

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.