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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:37:04+00:00 2026-05-15T09:37:04+00:00

I have seen the solution at http://www.rgagnon.com/javadetails/java-0506.html , but it doesn’t work correctly. E.g.

  • 0

I have seen the “solution” at http://www.rgagnon.com/javadetails/java-0506.html, but it doesn’t work correctly. E.g. yesterday (June 8) should have been 159, but it said it was 245.

So, does someone have a solution in Java for getting the current date’s three digit Julian day (not Julian date – I need the day this year)?

Thanks! Mark

  • 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-15T09:37:04+00:00Added an answer on May 15, 2026 at 9:37 am

    If all you want is the day-of-year, why don’you just use GregorianCalendars DAY_OF_YEAR field?

    import java.util.GregorianCalendar;
    public class CalTest {
        public static void main(String[] argv) {
            GregorianCalendar gc = new GregorianCalendar();
            gc.set(GregorianCalendar.DAY_OF_MONTH, 8);
            gc.set(GregorianCalendar.MONTH, GregorianCalendar.JUNE);
            gc.set(GregorianCalendar.YEAR, 2010);
            System.out.println(gc.get(GregorianCalendar.DAY_OF_YEAR));
    }
    

    }

    Alternatively, you could calculate the difference between today’s Julian date and that of Jan 1st of this year. But be sure to add 1 to the result, since Jan 1st is not the zeroth day of the year:

    int[] now = {2010, 6, 8};
    int[] janFirst = {2010, 1, 1};
    double dayOfYear = toJulian(now) - toJulian(janFirst) + 1
    System.out.println(Double.valueOf(dayOfYear).intValue());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen the solution to this a while back, but can't seem to
I have a site that utilizes a bottom fixed position masthead here: http://www.entheospartners.com/newsite/ This
I am trying to call the webservice that can be seen at: http://www.flexiblecarhire.com/flexibleservice/fchxmlinterface.asmx?op=GetAirportLocations I
Can someone recommend a hosted solution that answers the following requirements (I have seen
i have seen some hand rolled solutions but does jquery out of the box
I have tried several of the solutions I have seen out here, but am
this is a question i've seen here but the solution posted didn't resolve my
(I have researched this question extensively but not found an adequate solution yet.) I
Please have a look at this beautiful website : http://www.snipe.net/ If you are using
I just downloaded the Webmatrix 2 Prerelease Beta- http://www.microsoft.com/web/gallery/install.aspx?appid=webmatrix&prerelease=true I played around and made

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.