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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:38:38+00:00 2026-05-31T21:38:38+00:00

I have following code, my target is going to return GMT+0 time in millisec.

  • 0

I have following code, my target is going to return GMT+0 time in millisec. But Why I always get my local timezone millisec?

Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
Calendar cal2 = Calendar.getInstance();
System.out.println("Time zone id is:"+cal.getTimeZone().getID()+";time in millisec:"+cal.getTimeInMillis());
System.out.println("Time zone id is:"+cal2.getTimeZone().getID()+";time in millisec:"+cal2.getTimeInMillis());

The output is
Time zone id is:GMT;time in millisec:1332740915154
Time zone id is:Europe/Helsinki;time in millisec:1332740915154

Why different Timezone give SAME value in millisec?
I suppose if it is GMT+0 then it should be different value in millisec against local time zone.

  • 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-31T21:38:40+00:00Added an answer on May 31, 2026 at 9:38 pm

    Why different Timezone give SAME value in millisec?

    Because that’s what it’s meant to do. From the documentation:

    (Returns) the current time as UTC milliseconds from the epoch.

    In other words, it’s the value which would be in the Date returned by getTime – it doesn’t depend on the time zone. If you want values which depend on the time zone, use Calendar.Get(Calendar.YEAR) etc.

    Both Calendar.getTime() and Calendar.getTimeInMillis() return values representing the instant in time within the calendar, which is independent of both time zone and calendar system.

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

Sidebar

Related Questions

I have the following code for my custom Constraint: @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD
I have the following code: <script> $(document).ready(function() { $('.toggle_section').click(function(e){ parent = $(e.target).closest(div) objChild =
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public
I have been trying to get the following code to work(everything is defined in
I have the following code for example $(a.foo).bind(function (e){ var t; if ( $(e.target).is(a)
Hello I have following c++ code class classBase { public: int get1(){return 1;} int
I have the following code which is setting the target, href & textcontent for
I have the following code: $("#forma_mod_uid").livequery( function (){ $("#forma_mod_uid").ajaxForm({ beforeSubmit: mcargando("#cargando2"), target:'#mod_2', success: ocargando("#cargando2")
I have the following code on the page and it works in FF but
I have following Code Block Which I tried to optimize in the Optimized section

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.