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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:19:20+00:00 2026-06-18T05:19:20+00:00

In that code above I want to transform a Date by the TimeZone of

  • 0

In that code above I want to transform a Date by the TimeZone of Server (GMT-02:00) to TimeZone from my Device (GMT-03:00).
But I Always have the same Date of the server. What I doing wrong?

TimeZone timeZoneServer = TimeZone.getTimeZone(timeZoneServerString);
Long time = new Long(Long.valueOf(timeInMilis));

        Calendar calendarDateServer =   Calendar.getInstance(timeZoneServer);
        calendarDateServer.setTimeInMillis(time);
        long miliServer = calendarDateServer.getTimeInMillis();

        TimeZone timeZoneMeu = TimeZone.getDefault();
        Calendar meuCalendario =  new GregorianCalendar();
        meuCalendario.setTimeZone(timeZoneMeu);

        meuCalendario.setTimeInMillis(miliServer);  
        Date transformedDate = meuCalendario.getTime();


        return transformedDate; 
  • 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-18T05:19:21+00:00Added an answer on June 18, 2026 at 5:19 am

    What I doing wrong?

    You’re assuming that a Date has a time zone to start with. It doesn’t. A Calendar does, but a Date is just milliseconds since the Unix epoch. It doesn’t know about calendar systems or time zones. It’s just a point in time.

    It’s not clear what you want to do with the result – but if it’s a matter of formatting it for display, just use SimpleDateFormat and set the time zone on that instead.

    I would also strongly recommend that you use Joda Time instead of the built-in types… it’s a much more sensible API.

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

Sidebar

Related Questions

I want to get data from something, I have the code but I want
int main(void) { std::string foo(foo); } My understanding is that the above code uses
http://ideone.com/u0bVy the link above contain the code that i wrote for a class project.I
i have the following problem with that code in my html tag: <div id=searchbar><input
I don't understand why authors said that Code Listing 9.1 from Programming in Scala
Trying to abort from a before_request handler (in Flask) with that code gives the
I want to transform list to a string, but it contains integers. It works
I have a DB that contains a list of paths to files. I want
Languages that have closures, such as Ruby, enable elegant constructs to transform lists. Suppose
I have an app that scales it's UI and I want to scale the

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.