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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:57:13+00:00 2026-06-09T14:57:13+00:00

I just stumbled accross this method public static Date getNowDate() { final Calendar cal

  • 0

I just stumbled accross this method

public static Date getNowDate() {
    final Calendar cal = new GregorianCalendar();
    cal.setTime(new Date());
    return cal.getTime();
}

which gets called like this:

getNowDate().getTime()

Is this any different from just calling

System.currentTimeMillis()

?

  • 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-09T14:57:14+00:00Added an answer on June 9, 2026 at 2:57 pm

    They are all much the same except for performance.

    System.currentTimeMillis() is a system call so it takes around 0.1 to 0.3 micro-seconds (depending on your OS)

    new Date() also creates an object, which takes only about 0.1 to 0.3 micro-seconds more but creates a little garbage.

    Calendar.getInstance() creates an expensive set of objects and takes about 33 micro-seconds more.

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

Sidebar

Related Questions

I just read this question and stumbled upon the following quote: Scala treats ==
I just stumbled across this question and I noticed the user is using some
I've just stumbled across this fascinating article on the BBC website regarding producing music
I just stumbled across this bug in some legacy code: class MyAPIHandler { private:
I've just stumbled across this folder structure on my machine which contains lots of
So, I just stumbled across this one in another question : Parent constructors are
I've just stumbled across this and I'm a bit puzzled. I have an out-of-the-box
Ive just stumbled across property on a text box and it sounds the ideal
Just stumbled upon propertyGrid and its awesome! However, i have one task that i
I just stumbled upon a behavior which surprised me: When writing: int x =

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.